aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan <me@jordan.im>2024-01-24 16:24:28 -0700
committerJordan <me@jordan.im>2024-01-24 16:24:28 -0700
commite4c2d6f69b3fa83f5568047c8ae4d0f9ccc62e00 (patch)
tree3e1a4721ef0ade7e720005950907241694af0f05
parentfb07310bf45744f1eae582ce2546ed2dfcf50259 (diff)
downloadpipkin-e4c2d6f69b3fa83f5568047c8ae4d0f9ccc62e00.tar.gz
pipkin-e4c2d6f69b3fa83f5568047c8ae4d0f9ccc62e00.zip
presign: fix directory lists for empty prefix values (bucket root)
-rw-r--r--pipkin.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pipkin.go b/pipkin.go
index f8896ce..575d22e 100644
--- a/pipkin.go
+++ b/pipkin.go
@@ -72,7 +72,7 @@ type Contents struct {
}
// Headers we receive from clients and forward on to S3 endpoints.
-var ALLOWED_REQUEST_HEADERS = []string{
+var ALLOWED_REQUEST_HEADERS = [...]string{
"accept",
"accept-encoding",
"accept-language",
@@ -90,7 +90,7 @@ var ALLOWED_REQUEST_HEADERS = []string{
}
// Headers we receive from S3 and send back to requesting clients.
-var ALLOWED_RESPONSE_HEADERS = []string{
+var ALLOWED_RESPONSE_HEADERS = [...]string{
"accept-ranges",
"content-encoding",
"content-length",
@@ -350,7 +350,7 @@ func (pk *Pipkin) presignQuery(method string, host Host, key string) (string, er
uri.Add("X-Amz-Date", amzDateLong)
uri.Add("X-Amz-Expires", amzExpires)
uri.Add("X-Amz-SignedHeaders", amzSignedHeaders)
- if amzPrefix != "" {
+ if strings.HasSuffix(amzResource, "/") {
uri.Add("list-type", "2")
uri.Add("max-keys", "50000")
uri.Add("prefix", amzPrefix)