]> source.dussan.org Git - gitea.git/commitdiff
wrong link should 404
authorslene <vslene@gmail.com>
Thu, 20 Mar 2014 13:43:54 +0000 (21:43 +0800)
committerslene <vslene@gmail.com>
Thu, 20 Mar 2014 13:43:54 +0000 (21:43 +0800)
routers/repo/single.go

index e218bc9158d2a9e612354028351e42a333c7ae9b..f1b15cceed908d0bf8f8a82fb8211fa6825caedc 100644 (file)
@@ -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