Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: use strings.CutPrefix introduced in go1.20

Nick Craig-Woodbabd11266576
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index 3808b48a2..9fb2c51c8 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -6247,8 +6247,8 @@ func (o *Object) downloadFromURL(ctx context.Context, bucketPath string, options
metaData := make(map[string]string)
for key, value := range resp.Header {
key = strings.ToLower(key)
- if strings.HasPrefix(key, "x-amz-meta-") {
- metaKey := strings.TrimPrefix(key, "x-amz-meta-")
+ if after, ok := strings.CutPrefix(key, "x-amz-meta-"); ok {
+ metaKey := after
metaData[metaKey] = value[0]
}
}