Browse Source

Merge pull request #1404 from hilimd/master

S3 PutObject: fix create folder bug
pull/1507/head
Chris Lu 4 years ago
committed by GitHub
parent
commit
bfa07af326
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      weed/s3api/s3api_object_handlers.go

7
weed/s3api/s3api_object_handlers.go

@ -57,6 +57,12 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
}
defer dataReader.Close()
if strings.HasSuffix(object, "/") {
if err := s3a.mkdir(s3a.option.BucketsPath, bucket+object, nil); err != nil {
writeErrorResponse(w, ErrInternalError, r.URL)
return
}
} else {
uploadUrl := fmt.Sprintf("http://%s%s/%s%s", s3a.option.Filer, s3a.option.BucketsPath, bucket, object)
etag, errCode := s3a.putToFiler(r, uploadUrl, dataReader)
@ -67,6 +73,7 @@ func (s3a *S3ApiServer) PutObjectHandler(w http.ResponseWriter, r *http.Request)
}
setEtag(w, etag)
}
writeSuccessResponseEmpty(w)
}

Loading…
Cancel
Save