From 350d553cbe1643716c4b14c602fb25b2833ccadd Mon Sep 17 00:00:00 2001 From: jqzhang Date: Fri, 23 Aug 2019 09:51:59 +0800 Subject: [PATCH] cross domain options --- fileserver.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fileserver.go b/fileserver.go index 66b48984..605c9b97 100644 --- a/fileserver.go +++ b/fileserver.go @@ -2141,7 +2141,11 @@ func (this *Server) Upload(w http.ResponseWriter, r *http.Request) { output = r.FormValue("output") if Config().EnableCrossOrigin { this.CrossOrigin(w, r) + if r.Method == http.MethodOptions { + return + } } + if Config().AuthUrl != "" { if !this.CheckAuth(w, r) { log.Warn("auth fail", r.Form) @@ -2150,7 +2154,7 @@ func (this *Server) Upload(w http.ResponseWriter, r *http.Request) { return } } - if r.Method == "POST" { + if r.Method == http.MethodPost { md5sum = r.FormValue("md5") output = r.FormValue("output") if Config().ReadOnly {