I am getting this error after upgrading the AWSSDK.S3(3.7.107) for dot net core version 6.0. The same code is working fine using AWSSDK.S3(3.5.0.4) for dot net core 3.1.
var request = new GetPreSignedUrlRequest
{
BucketName = "bucket-name-mobile/test",
Key = "637431660687617131_Sachin_Pakale.jpg",
Expires = DateTime.Now.AddDays(1)
};
url = s3Client.GetPreSignedURL(request);
Found that the later version is encoding my URL by replaceing forward slash with %2F making it invalid.
<StringToSign>GET 1688208529 /bucket-name-mobile%2Ftest/637431660687617131_Sachin_Pakale.jpg</StringToSign>
My bucket name has forward slashes being the nested folder structure. Is there any workaround or provision to avoid this encoding? I am using USEast1 region.
Bucket name can't contain slashes. If your bucket contains "the folder" called test, then you need to modify your key parameter:
var request = new GetPreSignedUrlRequest
{
BucketName = "bucket-name-mobile",
Key = "test/637431660687617131_Sachin_Pakale.jpg",
Expires = DateTime.Now.AddDays(1)
};
url = s3Client.GetPreSignedURL(request);