Skip to content

Commit

Permalink
allow http.MethodOptions in s3.Headers call
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jun 9, 2021
1 parent fa18e36 commit dac788c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server/media/fs/filesys.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ func (fh *fshandler) Headers(req *http.Request, serve bool) (map[string]string,
}
var allowMethods string
if serve {
allowMethods = "GET, HEAD, OPTIONS"
allowMethods = "GET,HEAD,OPTIONS"
} else {
allowMethods = "POST, PUT, HEAD, OPTIONS"
allowMethods = "POST,PUT,HEAD,OPTIONS"
}
return map[string]string{
"Access-Control-Allow-Origin": allowedOrigin,
Expand Down
3 changes: 1 addition & 2 deletions server/media/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ func (ah *awshandler) Init(jsconf string) error {

// Headers redirects GET, HEAD requests to the AWS server.
func (ah *awshandler) Headers(req *http.Request, serve bool) (map[string]string, int, error) {

if req.Method == http.MethodPut || req.Method == http.MethodPost {
if req.Method == http.MethodPut || req.Method == http.MethodPost || req.Method == http.MethodOptions {
return nil, 0, nil
}

Expand Down

0 comments on commit dac788c

Please sign in to comment.