diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2025-11-04 20:03:36 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2025-11-04 20:03:36 +0500 |
| commit | 1abea0d9b5ba7d4a54fdeeed386ec8d519aafccf (patch) | |
| tree | 2e9b15f507359db02426a321aad129fc2612cee7 | |
| parent | e8e080b4fad95e4575abfff38335e58043c2d6c8 (diff) | |
| download | seaweedfs-1abea0d9b5ba7d4a54fdeeed386ec8d519aafccf.tar.xz seaweedfs-1abea0d9b5ba7d4a54fdeeed386ec8d519aafccf.zip | |
test s3 put
| -rw-r--r-- | weed/s3api/filer_multipart.go | 2 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write.go | 6 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write_autochunk.go | 21 |
3 files changed, 21 insertions, 8 deletions
diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go index 946e9b798..757401669 100644 --- a/weed/s3api/filer_multipart.go +++ b/weed/s3api/filer_multipart.go @@ -468,7 +468,7 @@ func (s3a *S3ApiServer) completeMultipartUpload(r *http.Request, input *s3.Compl entry.Attributes.Mime = mime } entry.Attributes.FileSize = uint64(offset) - if s3a.option.AllowDeleteObjectsByTTL && entry.Attributes.TtlSec > 0 { + if s3a.option.AllowDeleteObjectsByTTL { entry.Extended[s3_constants.SeaweedFSExpiresS3] = []byte("true") } }) diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go index 1d897626c..6888a9b50 100644 --- a/weed/server/filer_server_handlers_write.go +++ b/weed/server/filer_server_handlers_write.go @@ -98,12 +98,6 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, conte } return } - // Disable TTL-based (creation time) deletion when S3 expiry (modification time) is enabled - if so.TtlSeconds > 0 { - if s3ExpiresValue := r.Header.Get(s3_constants.SeaweedFSExpiresS3); s3ExpiresValue == "true" { - so.TtlSeconds = 0 - } - } if util.FullPath(r.URL.Path).IsLongerFileName(so.MaxFileNameLength) { glog.V(1).InfolnCtx(ctx, "post", r.RequestURI, ": ", "entry name too long") w.WriteHeader(http.StatusRequestURITooLong) diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index 308a0421a..4525af61e 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -136,8 +136,27 @@ func (fs *FilerServer) doPutAutoChunk(ctx context.Context, w http.ResponseWriter if err := fs.checkPermissions(ctx, r, fileName); err != nil { return nil, nil, err } + // Disable TTL-based (creation time) deletion when S3 expiry (modification time) is enabled + soMaybeWithOutTTL := so + if so.TtlSeconds > 0 { + if s3ExpiresValue := r.Header.Get(s3_constants.SeaweedFSExpiresS3); s3ExpiresValue == "true" { + soMaybeWithOutTTL = &operation.StorageOption{ + so.Replication, + so.DiskType, + so.Collection, + so.DataCenter, + so.Rack, + so.DataNode, + 0, + so.VolumeGrowthCount, + so.MaxFileNameLength, + so.Fsync, + so.SaveInside, + } + } + } - fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadRequestToChunks(ctx, w, r, r.Body, chunkSize, fileName, contentType, contentLength, so) + fileChunks, md5Hash, chunkOffset, err, smallContent := fs.uploadRequestToChunks(ctx, w, r, r.Body, chunkSize, fileName, contentType, contentLength, soMaybeWithOutTTL) if err != nil { return nil, nil, err |
