781flyingdutchman / background_downloader

Flutter plugin for file downloads and uploads
Other
162 stars 76 forks source link

Binary upload header 'Content-Disposition' is not encoded properly #376

Closed Ansis100 closed 1 month ago

Ansis100 commented 2 months ago

The header parameter filename in multipartUpload is properly encoded: https://github.com/781flyingdutchman/background_downloader/blob/0fd47563c0239c5dcf8e1e0d9cd425ff0433e9d8/lib/src/desktop/upload_isolate.dart#L134-L137

However, in binaryUpload it is not: https://github.com/781flyingdutchman/background_downloader/blob/0fd47563c0239c5dcf8e1e0d9cd425ff0433e9d8/lib/src/desktop/upload_isolate.dart#L52-L53

Which leads to "Invalid HTTP header" errors when trying to upload files with non-latin characters.

Ansis100 commented 2 months ago

I didn't notice that browserEncode does not actually perform encoding but only replaces some characters. I'm guessing we would need to use Uri.encodeComponent.

781flyingdutchman commented 1 month ago

Included in V8.5.6