Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix(remote): don't send empty StorageClass in S3 uploads (#8645)

Chris Lub868980260e3
diff --git a/weed/remote_storage/s3/s3_storage_client.go b/weed/remote_storage/s3/s3_storage_client.go
index 7f82808f8a..4d12998e76 100644
--- a/weed/remote_storage/s3/s3_storage_client.go
+++ b/weed/remote_storage/s3/s3_storage_client.go
@@ -275,13 +275,16 @@ func (s *s3RemoteStorageClient) WriteFile(loc *remote_pb.RemoteStorageLocation,
}
// Upload the file to S3.
- _, err = uploader.Upload(&s3manager.UploadInput{
- Bucket: aws.String(loc.Bucket),
- Key: aws.String(loc.Path[1:]),
- Body: reader,
- Tagging: awsTags,
- StorageClass: aws.String(s.conf.S3StorageClass),
- })
+ uploadInput := &s3manager.UploadInput{
+ Bucket: aws.String(loc.Bucket),
+ Key: aws.String(loc.Path[1:]),
+ Body: reader,
+ Tagging: awsTags,
+ }
+ if s.conf.S3StorageClass != "" {
+ uploadInput.StorageClass = aws.String(s.conf.S3StorageClass)
+ }
+ _, err = uploader.Upload(uploadInput)
//in case it fails to upload
if err != nil {