Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【bug】upload directory failed using aws sdk net #1291

Closed
yh371174229 opened this issue May 13, 2019 · 2 comments
Closed

【bug】upload directory failed using aws sdk net #1291

yh371174229 opened this issue May 13, 2019 · 2 comments
Labels
bug This issue is a bug. closed-for-staleness

Comments

@yh371174229
Copy link

yh371174229 commented May 13, 2019

Upload folder with 3 files

Static void Main()
{
                TransferUtilityUploadDirectoryRequest request = new TransferUtilityUploadDirectoryRequest
                {
                    BucketName = "test20190505",
                    Directory = @"E:\0\File",
                    SearchOption = SearchOption.AllDirectories,
                    SearchPattern="*.*"
                };
                request.UploadDirectoryProgressEvent += request_UploadDirectoryProgressEvent;
                request.UploadDirectoryFileRequestEvent += request_UploadDirectoryFileRequestEvent;
                TransferUtility directoryTransferUtility = new TransferUtility(s3Client);
                UploadFolder(request, directoryTransferUtility, "Test/Folder");
}
        private static void UploadFolder(TransferUtilityUploadDirectoryRequest request, TransferUtility tfUtility, string keyPrefix)
        {
            string inPath = request.Directory;
            if (System.IO.Directory.Exists(inPath))
            {
                request.KeyPrefix = keyPrefix;
                tfUtility.UploadDirectory(request);
                string[] subDirArray = System.IO.Directory.GetDirectories(inPath);
                foreach (string subDir in subDirArray)
                {
                    request.Directory = subDir;
                    string subKeyPrefix = keyPrefix + "/" + System.IO.Path.GetFileName(subDir);
                    UploadFolder(request, tfUtility, subKeyPrefix);
                }
            }
        }

This is the folder picture
image

The Exception Error making request with Error Code SignatureDoesNotMatch and Http Status Code Forbidden. No further error information was returned by the service.

   在 Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException(IExecutionContext executionContext, HttpErrorResponseException exception)
   在 Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception)
   在 Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception)
   在 Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.Signer.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.S3.Internal.AmazonS3KmsHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.EndpointResolver.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.S3.Internal.AmazonS3PostMarshallHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.Marshaller.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.S3.Internal.AmazonS3PreMarshallHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
   在 Amazon.Runtime.AmazonServiceClient.Invoke[TResponse](AmazonWebServiceRequest request, InvokeOptionsBase options)
   在 Amazon.S3.AmazonS3Client.PutObject(PutObjectRequest request)
   在 ConsoleApp1.Program.Main(String[] args) 位置 E:\工作\GitHub\aws-sdk-net-master\sdk\ConsoleApp1\Program.cs:行号 99

Failed to upload the file in the folder.
If the filename is chinese string,then upload folder will ignore the files or upload failed.
If the filename is English string,then upload folder will success。
I think this is a bug.Hope to receive a reply.

I want to know when will solve this bug ? the bug made me so sad,who can help me?
This url is I found,but I don't know how to set metadata encode

@yh371174229 yh371174229 changed the title upload directory failed using aws sdk net 【bug】upload directory failed using aws sdk net May 13, 2019
@sstevenkang sstevenkang added the bug This issue is a bug. label May 13, 2019
@yh371174229
Copy link
Author

yh371174229 commented May 15, 2019

https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/dev/UsingMetadata.html
@sstevenkang
I know the reason,the bug is beacause the key name,the key name is must be Unicode.Chinese characters maybe not supported now.

Open-source tools are available to convert filenames for non-Unicode files. For example, to convert from latin1 (a common Windows encoding) to Unicode, you can use Windows iconv. For Unix-based systems, you can use libiconv.

@github-actions
Copy link

We have noticed this issue has not recieved attention in a year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jul 10, 2020
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness
Projects
None yet
Development

No branches or pull requests

2 participants