This is a migrated thread and some comments may be shown as answers.

Problem with accents (éêèà) on file even with custom KeyName

2 Answers 161 Views
CloudUpload
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 11 Dec 2015, 03:22 PM

Hi,

There seem to be a bug with RadCloudUpload when uploading files containing accents even when removing the accents using SetKeyName . You can reproduce the problem using the online demo: 

http://demos.telerik.com/aspnet-ajax/cloud-upload/examples/overview/defaultcs.aspx

Try to upload a file named testé.txt and it will simply spin forever... with the Azure Provider it will give a 400 bad request error.

This bug occurs even when using a custom keyname (ie: renaming testé.txt to test.txt)

It looks like it's posting an empty keyname in the form-data / metadata

 ------WebKitFormBoundary27qdoJuKD1bZGORUContent-Disposition: form-data; name="rcuConfigurationData" o7YTRi9y7g5a87elRnSedOyIfTEV6yRP4qSiSAbpKNqJACur2dz8NDNMqtQYwyZm+gslxpwauOF6zoZHoyrVz4z+x6D3YzCZt0GJWxCPX96H/e9o635zvsgBjRPk0kV0cj+OKg==

------WebKitFormBoundary27qdoJuKD1bZGORUContent-Disposition: form-data; name="file"; filename="blob"Content-Type: application/octet-strea------WebKitFormBoundary27qdoJuKD1bZGORUContent-Disposition: form-data; name="rcuPostData" {"KeyName":"","OriginalName":"testé.txt","UploadId":"","IsSingleUpload":true,"IsLastChunk":true,"ChunkNumber":1,"PartEtags":[]}------WebKitFormBoundary27qdoJuKD1bZGORU--

Exception thrown for upload operation for file with keyName: test.txt
Telerik.Web.UI.CloudUploadProviderException
   at Telerik.Web.UI.AzureProvider.UploadFileOnSigleRequest(String keyName, NameValueCollection metaData, Stream fileStream)
   at Telerik.Web.UI.AzureProvider.UploadFile(String keyName, NameValueCollection metaData, Stream fileStream)
   at Telerik.Web.UI.CloudUpload.BaseWorker.PerformSingleRequestUpload()
   at Telerik.Web.UI.CloudUpload.BaseWorker.Process()
   at Telerik.Web.UI.CloudUploadHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Telerik.Web.UI
The remote server returned an error: (400) Bad Request.
Microsoft.WindowsAzure.Storage.StorageException
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.SetMetadata(AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
   at Telerik.Web.UI.AzureProvider.UploadFileOnSigleRequest(String keyName, NameValueCollection metaData, Stream fileStream)

Microsoft.WindowsAzure.Storage
The remote server returned an error: (400) Bad Request.
System.Net.WebException
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)

I am using Telerik 2015.1.401.45

Please let me know if a hotfix or workaround is possible.

Thanks,

Kim

2 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 16 Dec 2015, 11:14 AM
Hello Kim,

Thank you for contacting Telerik Support.

Perhaps the file name that you are trying to upload is invalid according to the Azure Blob Naming convention. That's why it is needed to rename the file before it is uploaded. Look at this sample:
https://github.com/hvalyavicharski/telerik-radcontrols/tree/master/RadCloudUpload/Custom-Handler-File-Ranaming

although it uses Amazon, the approach is completely the same. And here is a sample method to escape the invalid characters: http://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/how-to/how-to-upload-files-from-mac-or-linux

Let me know if I can assist you further.

Regards,
Hristo Valyavicharski
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kim
Top achievements
Rank 1
answered on 04 Jan 2016, 09:54 PM

Hi Hristo,

As mentioned in the original post, I rename the file name (keyname) to "test.txt" using the custom handler and that doesn't work. Also, the Azure Blob Naming convention allows accents.

It looks like Azure METADATA cannot contains non-ascii characters: http://stackoverflow.com/questions/14899461/invalid-character-exception-when-adding-metadata-to-a-cloudblob

The bug seems to be in Telerik.Web.UI.CloudUploadHandler.SetMetaData() which uses the original filename to set the metadata "filename".

To fix this, I simply override the SetMetaData method in the custom handler:

        public override void SetMetaData(object sender, Telerik.Web.UI.CloudUpload.SetMetaDataEventArgs e)
        {
            // workaround for bug with telerik, do not set any metadata
        }

Thanks

Tags
CloudUpload
Asked by
Kim
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Kim
Top achievements
Rank 1
Share this question
or