소스 검색

wrong link should 404

slene 11 년 전
부모
커밋
b4a55434a4
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      routers/repo/single.go

+ 5 - 0
routers/repo/single.go

@@ -87,6 +87,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
 
 	branchLink := "/" + ctx.Repo.Owner.LowerName + "/" + ctx.Repo.Repository.Name + "/src/" + params["branchname"]
 
+	if len(treename) != 0 && repoFile == nil {
+		ctx.Error(404)
+		return
+	}
+
 	if repoFile != nil && repoFile.IsFile() {
 		if repoFile.Size > 1024*1024 || repoFile.Filemode != git.FileModeBlob {
 			ctx.Data["FileIsLarge"] = true