s3: fix crash when using --s3-download-url after migration to SDKv2

Before this change rclone was crashing when the download URL did not
supply an X-Amz-Storage-Class header.

This change allows the header to be missing.

See: https://forum.rclone.org/t/sigsegv-on-ubuntu-24-04/48047
This commit is contained in:
Nick Craig-Wood 2024-10-03 10:21:05 +01:00
parent e7a0fd0f70
commit 1ca3f12672

View File

@ -5829,7 +5829,7 @@ func (o *Object) downloadFromURL(ctx context.Context, bucketPath string, options
ContentEncoding: header("Content-Encoding"), ContentEncoding: header("Content-Encoding"),
ContentLanguage: header("Content-Language"), ContentLanguage: header("Content-Language"),
ContentType: header("Content-Type"), ContentType: header("Content-Type"),
StorageClass: types.StorageClass(*header("X-Amz-Storage-Class")), StorageClass: types.StorageClass(deref(header("X-Amz-Storage-Class"))),
} }
o.setMetaData(&head) o.setMetaData(&head)
return resp.Body, err return resp.Body, err