-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
Describe the bug
If you try to upload a file that has non-ASCII characters in its filename (eg. ÄÖäö.jpg), then Content-Disposition is encoded to smth like "=?utf-8?B?S29hbGHDhMOWw6TDti5qcGc=?="
To Reproduce
- Set a breakpoint to https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Request/RequestContent.cs#L65
- Rename test file Koala.jpg to KoalaÄÖäö.jpg
- Change test data (to filename = "KoalaÄÖäö.jpg") and run an upload test eg. Should_upload_from_file
- Check fileContent.Headers.ContentDisposition value in RequestContent.AddFiles()
Expected behavior
fileContent.Headers.ContentDisposition - form-data; name="file"; filename="ÄÖäö.jpg"
Actual behavior
fileContent.Headers.ContentDisposition - form-data; name="file"; filename="=?utf-8?B?S29hbGHDhMOWw6TDti5qcGc=?="
Notes
For a file like Koala.jpg fileContent.Headers.ContentDisposition is form-data; name="file"; filename="Koala.jpg".
Initially, it's an issue with ContentDispositionHeaderValue (microsoft/referencesource#140), but I don't know how to fix it there.