From 54e0ada9d53c28543a436d266dc73e759cc7658b Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 14 Aug 2016 23:38:35 -0700 Subject: Web editor: improve delete file --- cmd/web.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmd/web.go') 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() { -- cgit v1.2.3