mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-09-19 15:31:05 +02:00
s3api do not proxy directory requests
This commit is contained in:
parent
7f32eb1e25
commit
ebad3a44ab
|
@ -8,6 +8,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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) {
|
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",
|
destUrl := fmt.Sprintf("http://%s%s%s",
|
||||||
s3a.option.Filer, s3a.option.BucketsPath, r.RequestURI)
|
s3a.option.Filer, s3a.option.BucketsPath, r.RequestURI)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
|
||||||
// DeleteBucket
|
// DeleteBucket
|
||||||
bucket.Methods("DELETE").HandlerFunc(s3a.DeleteBucketHandler)
|
bucket.Methods("DELETE").HandlerFunc(s3a.DeleteBucketHandler)
|
||||||
|
|
||||||
// GetObject
|
// GetObject, but directory listing is not supported
|
||||||
bucket.Methods("GET").Path("/{object:.+}").HandlerFunc(s3a.GetObjectHandler)
|
bucket.Methods("GET").Path("/{object:.+}").HandlerFunc(s3a.GetObjectHandler)
|
||||||
// ListObjectsV2
|
// ListObjectsV2
|
||||||
bucket.Methods("GET").HandlerFunc(s3a.ListObjectsV2Handler).Queries("list-type", "2")
|
bucket.Methods("GET").HandlerFunc(s3a.ListObjectsV2Handler).Queries("list-type", "2")
|
||||||
|
|
Loading…
Reference in a new issue