summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go4
-rw-r--r--templates/index.html2
2 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 949d2f3..3e2cd86 100644
--- a/main.go
+++ b/main.go
@@ -69,6 +69,10 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
w.WriteHeader(http.StatusNoContent)
case http.MethodPost:
+ if r.URL.Path != "/upload" {
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
token := r.Header.Get("X-Upload-Token")
if token != handler.token {
log.Println("unauthorized")
diff --git a/templates/index.html b/templates/index.html
index c487165..9264991 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -36,7 +36,7 @@
resourceId = xhr.getResponseHeader("X-Resource-ID");
}
}
- xhr.open("POST", "/" + f.name, true);
+ xhr.open("POST", "/upload", true);
xhr.setRequestHeader("X-Upload-Token", token)
xhr.send(f)
}