Allow passing the upload token as query string for reading

This commit is contained in:
simon987
2019-03-10 11:14:44 -04:00
parent b05c9f2b1a
commit c41ed01184
2 changed files with 35 additions and 0 deletions

View File

@@ -142,6 +142,9 @@ func (api *WebApi) Upload(ctx *fasthttp.RequestCtx) {
func (api *WebApi) ReadUploadSlot(ctx *fasthttp.RequestCtx) {
tokenStr := string(ctx.Request.Header.Peek("X-Upload-Token"))
if tokenStr == "" {
tokenStr = string(ctx.Request.URI().QueryArgs().Peek("token"))
}
slot := UploadSlot{}
err := api.db.Where("token=?", tokenStr).First(&slot).Error