summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-30 05:07:50 -0700
committerUnknwon <u@gogs.io>2016-08-30 05:23:59 -0700
commit643142acab44d46aa6c001c90ad5d307a8662b99 (patch)
tree8e26f8959af5175e865d71a35df5dc087ff14dc8 /cmd
parent7c31f235da287b0ba1499986758332c2c346deb0 (diff)
downloadgitea-643142acab44d46aa6c001c90ad5d307a8662b99.tar.gz
gitea-643142acab44d46aa6c001c90ad5d307a8662b99.zip
Web editor: support upload files
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go16
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)