mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	response 404 for diff/patch of a commit that not exist (#15221)
* response 404 for diff/patch of a commit that not exist fix #15217 Signed-off-by: a1012112796 <1012112796@qq.com> * Update routers/repo/commit.go Co-authored-by: silverwind <me@silverwind.io> * use ctx.NotFound() Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		| @@ -6,6 +6,7 @@ | ||||
| package repo | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"path" | ||||
| 	"strings" | ||||
|  | ||||
| @@ -388,6 +389,11 @@ func RawDiff(ctx *context.Context) { | ||||
| 		git.RawDiffType(ctx.Params(":ext")), | ||||
| 		ctx.Resp, | ||||
| 	); err != nil { | ||||
| 		if git.IsErrNotExist(err) { | ||||
| 			ctx.NotFound("GetRawDiff", | ||||
| 				errors.New("commit "+ctx.Params(":sha")+" does not exist.")) | ||||
| 			return | ||||
| 		} | ||||
| 		ctx.ServerError("GetRawDiff", err) | ||||
| 		return | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user