aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_handlers.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-10-21 20:04:11 +0800
committerGitHub <noreply@github.com>2020-10-21 20:04:11 +0800
commitab1105c52472946efab9713bf15df45e14ff4514 (patch)
tree7af939a22f3efbf055054670ec8d2e3f11a79ad6 /weed/s3api/s3api_object_handlers.go
parent2c40f56e5a2e4792361b6df0bb6e879726f340ab (diff)
parent81cf8d04dfcbb84093044de4f10a8a92d9c8bd1c (diff)
downloadseaweedfs-ab1105c52472946efab9713bf15df45e14ff4514.tar.xz
seaweedfs-ab1105c52472946efab9713bf15df45e14ff4514.zip
Merge pull request #31 from chrislusf/master
sync
Diffstat (limited to 'weed/s3api/s3api_object_handlers.go')
-rw-r--r--weed/s3api/s3api_object_handlers.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go
index 93d6db79f..fa628f44e 100644
--- a/weed/s3api/s3api_object_handlers.go
+++ b/weed/s3api/s3api_object_handlers.go
@@ -5,12 +5,13 @@ import (
"encoding/json"
"encoding/xml"
"fmt"
- "github.com/chrislusf/seaweedfs/weed/s3api/s3err"
"io"
"io/ioutil"
"net/http"
"strings"
+ "github.com/chrislusf/seaweedfs/weed/s3api/s3err"
+
"github.com/gorilla/mux"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -333,7 +334,7 @@ func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader
}
if ret.Error != "" {
glog.Errorf("upload to filer error: %v", ret.Error)
- return "", s3err.ErrInternalError
+ return "", filerErrorToS3Error(ret.Error)
}
return etag, s3err.ErrNone
@@ -359,3 +360,10 @@ func getBucketAndObject(r *http.Request) (bucket, object string) {
return
}
+
+func filerErrorToS3Error(errString string) s3err.ErrorCode {
+ if strings.HasPrefix(errString, "existing ") && strings.HasSuffix(errString, "is a directory") {
+ return s3err.ErrExistingObjectIsDirectory
+ }
+ return s3err.ErrInternalError
+}