diff options
Diffstat (limited to 'weed/s3api/s3_constants/header.go')
| -rw-r--r-- | weed/s3api/s3_constants/header.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/weed/s3api/s3_constants/header.go b/weed/s3api/s3_constants/header.go index 765b2a0f1..82b2b116a 100644 --- a/weed/s3api/s3_constants/header.go +++ b/weed/s3api/s3_constants/header.go @@ -17,9 +17,10 @@ package s3_constants import ( - "github.com/gorilla/mux" "net/http" "strings" + + "github.com/gorilla/mux" ) // Standard S3 HTTP request constants @@ -72,6 +73,16 @@ func GetBucketAndObject(r *http.Request) (bucket, object string) { return } +func GetPrefix(r *http.Request) string { + query := r.URL.Query() + prefix := query.Get("prefix") + if !strings.HasPrefix(prefix, "/") { + prefix = "/" + prefix + } + + return prefix +} + var PassThroughHeaders = map[string]string{ "response-cache-control": "Cache-Control", "response-content-disposition": "Content-Disposition", |
