summaryrefslogtreecommitdiffstats
path: root/cmd/web.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-14 23:38:35 -0700
committerUnknwon <u@gogs.io>2016-08-14 23:52:24 -0700
commit54e0ada9d53c28543a436d266dc73e759cc7658b (patch)
treeadafc14fd67620258077d94e96579f47111e87b1 /cmd/web.go
parentcd89f6c5021ef129ecc4652aa620a3562ae30979 (diff)
downloadgitea-54e0ada9d53c28543a436d266dc73e759cc7658b.tar.gz
gitea-54e0ada9d53c28543a436d266dc73e759cc7658b.zip
Web editor: improve delete file
Diffstat (limited to 'cmd/web.go')
-rw-r--r--cmd/web.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd/web.go b/cmd/web.go
index db18890f1d..d14d1efcd9 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -503,14 +503,19 @@ func runWeb(ctx *cli.Context) error {
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.EditFilePost)
m.Combo("/_new/*").Get(repo.NewFile).
Post(bindIgnErr(auth.EditRepoFileForm{}), repo.NewFilePost)
- m.Post("/preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
+ m.Post("/_preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost)
m.Combo("/upload/*").Get(repo.UploadFile).
Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost)
- m.Post("/delete/*", bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
+ m.Post("/_delete/*", bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost)
m.Post("/branches", bindIgnErr(auth.NewBranchForm{}), repo.NewBranchPost)
m.Post("/upload-file", repo.UploadFileToServer)
m.Post("/upload-remove", bindIgnErr(auth.RemoveUploadFileForm{}), repo.RemoveUploadFileFromServer)
- }, reqRepoWriter, context.RepoRef())
+ }, reqRepoWriter, context.RepoRef(), func(ctx *context.Context) {
+ if ctx.Repo.IsViewCommit {
+ ctx.Handle(404, "", nil)
+ return
+ }
+ })
}, reqSignIn, context.RepoAssignment(), repo.MustBeNotBare)
m.Group("/:username/:reponame", func() {