Downloading a file with TransferUtility fails if path contains special characters #2470
-
Describe the bugWe download files from S3 buckets with the
Expected BehaviorThe file should be downloaded successfully. Current BehaviorException is raised:
Reproduction Steps
using Amazon;
using Amazon.Runtime;
using Amazon.S3;
using Amazon.S3.Transfer;
var region = RegionEndpoint.GetBySystemName("us-east-2");
var credentials = new BasicAWSCredentials(
"***",
"***");
var client = new AmazonS3Client(credentials, region);
var fileTransferUtility = new TransferUtility(client);
var request = new TransferUtilityDownloadRequest
{
BucketName = "LongFolder_1234567890£",
FilePath = @"c:\Temp\LocalFile.txt",
Key = "RemoteFile.txt"
};
await fileTransferUtility.DownloadAsync(request);
System.Console.WriteLine("File is downloaded successfully"); Possible SolutionNo response Additional Information/ContextLooks like this bug was introduced between versions 3.7.10.1 and 3.7.100 AWS .NET SDK and/or Package version usedAWSSDK.S3 3.7.101.7 Targeted .NET Platform.NET 6 Operating System and versionWindows 11 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @olesmartyniuk, Good morning. I'm curious if you are able to create bucket name with special characters from AWS Console. I tried creating bucket with name I tried creating bucket with this name since you are specifying Using your scenario, I was able to create using Amazon;
using Amazon.Runtime;
using Amazon.S3;
using Amazon.S3.Transfer;
var region = RegionEndpoint.GetBySystemName("us-east-2");
var client = new AmazonS3Client(region);
var fileTransferUtility = new TransferUtility(client);
var request = new TransferUtilityDownloadRequest
{
BucketName = "testbucket-issue1880",
FilePath = @"/tmp/LocalFile.png",
Key = "LongFolder_1234567890£/Screen Shot 2022-10-07 at 12.35.04 PM.png"
};
await fileTransferUtility.DownloadAsync(request);
System.Console.WriteLine("File is downloaded successfully"); So you are using wrong bucket name, instead you should be using folder name as part of the Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @olesmartyniuk,
Good morning.
I'm curious if you are able to create bucket name with special characters from AWS Console. I tried creating bucket with name
TestBucket_1234567890£
and it gave me errorBucket name must not contain uppercase characters Bucket name contains invalid characters: _, £
.I tried creating bucket with this name since you are specifying
LongFolder_1234567890£
inBucketName
property.Using your scenario, I was able to create
LongFolder_1234567890£
folder though and then uploaded a file to the folder. Then using the below code (usedAWSSDK.S3
version3.7.101.7
) downloads the file successfully: