781flyingdutchman/background_downloader

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

Closed this issue · 2 comments

The header parameter filename in multipartUpload is properly encoded:

contentDispositionStrings.add(
'Content-Disposition: form-data; name="${browserEncode(fileField)}"; '
'filename="${browserEncode(p.basename(file.path))}"$lineFeed',
);

However, in binaryUpload it is not:

request.headers['Content-Disposition'] =
'attachment; filename="${task.filename}"';

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

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.

Included in V8.5.6