Skip to content

Filename encoding issue in latest version. #2117

Description

@kashifjaved1

I'm using the latest stable version of restsharp (v110.2.0) to upload zip file to external link with name "Präsentation_Export" but after successful upload got "Pr�sentation_Export" from restsharp. I had done this work successfully working in version 105.2.3 but in v110.2.0 its not working.
Below is my controller method:

publicasyncTask<ApiResponse>UploadRequest(int?Id,IFormFilefile,stringAPIEndPoint,stringMethodType){ApiResponseresult=newApiResponse();try{varqueryString=newDictionary<string,string>(){{"access_token",AccessToken}};Uriuri=newUri(string.Format(BaseURL+APIEndPoint,string.Empty));varrequestUri=QueryHelpers.AddQueryString(uri.ToString(),queryString);usingvarmemoryStream=newMemoryStream();varclient=newRestClient(uri);awaitfile.CopyToAsync(memoryStream);//var restRequest = new RestRequest(requestUri, Method.Post);restRequest.AddHeader("Content-Type","multipart/form-data");varrestRequest=newRestRequest("https://tpsupport.tpondemand.com/",Method.Post).AddFile("attachment",memoryStream.ToArray(),file.FileName,file.ContentType,options:newFileParameterOptions{DisableFilenameEncoding=true});if(Id!=null){restRequest.AddParameter("generalId",Id.Value);}varresponse=awaitclient.ExecuteAsync(restRequest);stringresultContent=response.Content;if(response.IsSuccessStatusCode){result.Data=resultContent;}else{result.ExceptionObject=JsonConvert.DeserializeObject<Exception>(resultContent);}result.StatusCode=(int)response.StatusCode;returnresult;}catch(Exceptionex){result.ExceptionObject=ex;result.StatusCode=500;returnresult;}}

Desktop:

OS: Windows 11
.NET version 4.7.2
Version 110.2.0

Additional Information:
I'm uploading file with name "Präsentation_Export.zip", but after successful upload getting it with name "Pr�sentation_Export.zip".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions