aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-07-23 01:15:59 -0700
committerChris Lu <chris.lu@gmail.com>2018-07-23 01:15:59 -0700
commitebad3a44abfee8c00e0d35b8e242f8700ab2be01 (patch)
tree8500af60b88557557b8b04ce908bd652bde516e1
parent7f32eb1e25ab22f1276d60d15d81b6bf84a79d3c (diff)
downloadseaweedfs-ebad3a44abfee8c00e0d35b8e242f8700ab2be01.tar.xz
seaweedfs-ebad3a44abfee8c00e0d35b8e242f8700ab2be01.zip
s3api do not proxy directory requests
-rw-r--r--weed/s3api/s3api_object_handlers.go6
-rw-r--r--weed/s3api/s3api_server.go2
2 files changed, 7 insertions, 1 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index a9be99d2f..f0d13af05 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"
"net/http"
+ "strings"
)
var (
@@ -92,6 +93,11 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
func (s3a *S3ApiServer) GetObjectHandler(w http.ResponseWriter, r *http.Request) {
+ if strings.HasSuffix(r.URL.Path, "/") {
+ writeErrorResponse(w, ErrNotImplemented, r.URL)
+ return
+ }
+
destUrl := fmt.Sprintf("http://%s%s%s",
s3a.option.Filer, s3a.option.BucketsPath, r.RequestURI)
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go
index b33c6f07b..0b3826625 100644
--- a/weed/s3api/s3api_server.go
+++ b/weed/s3api/s3api_server.go
@@ -58,7 +58,7 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
// DeleteBucket
bucket.Methods("DELETE").HandlerFunc(s3a.DeleteBucketHandler)
- // GetObject
+ // GetObject, but directory listing is not supported
bucket.Methods("GET").Path("/{object:.+}").HandlerFunc(s3a.GetObjectHandler)
// ListObjectsV2
bucket.Methods("GET").HandlerFunc(s3a.ListObjectsV2Handler).Queries("list-type", "2")