diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd/web.go b/cmd/web.go index 3a1108a45c..92e7fef423 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -505,12 +505,20 @@ func runWeb(ctx *cli.Context) error { m.Combo("/_new/*").Get(repo.NewFile). Post(bindIgnErr(auth.EditRepoFileForm{}), repo.NewFilePost) m.Post("/_preview/*", bindIgnErr(auth.EditPreviewDiffForm{}), repo.DiffPreviewPost) - m.Combo("/_upload/*").Get(repo.UploadFile). - Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost) m.Combo("/_delete/*").Get(repo.DeleteFile). Post(bindIgnErr(auth.DeleteRepoFileForm{}), repo.DeleteFilePost) - // m.Post("/upload-file", repo.UploadFileToServer) - // m.Post("/upload-remove", bindIgnErr(auth.RemoveUploadFileForm{}), repo.RemoveUploadFileFromServer) + + m.Group("", func() { + m.Combo("/_upload/*").Get(repo.UploadFile). + Post(bindIgnErr(auth.UploadRepoFileForm{}), repo.UploadFilePost) + m.Post("/upload-file", repo.UploadFileToServer) + m.Post("/upload-remove", bindIgnErr(auth.RemoveUploadFileForm{}), repo.RemoveUploadFileFromServer) + }, func(ctx *context.Context) { + if !setting.Repository.Upload.Enabled { + ctx.Handle(404, "", nil) + return + } + }) }, reqRepoWriter, context.RepoRef(), func(ctx *context.Context) { if !ctx.Repo.Repository.CanEnableEditor() || ctx.Repo.IsViewCommit { ctx.Handle(404, "", nil) |