dropzone icon indicating copy to clipboard operation
dropzone copied to clipboard

uri-encode filename because of rfc6266 section-4.3

Open fuminori-ido-m opened this issue 2 years ago • 0 comments

Issue

It is treated as URI-encoded already when filename contains '%' so that the when original filename contains '%' like a-%61.txt then it is converted to a-a.txt at server-side.

Reason

According to RFC6266 section-4.3, filename should be uri-encoded in form-data while in dropzone.js FormData append part passes raw filename via _renameFile() as follows in src/dropzone.js:

_renameFile(file) { ... return file.name; ... filename: this._renameFile(file), ... formData.append(dataBlock.name, dataBlock.data, dataBlock.filename);

Solution

This PR encode by encodeURIComponent() at _renameFile when renameFile hook is not defined.

(I didn't touch user-customized renameFile() so that user need to take care about '%' issue mentioned above.)

fuminori-ido-m avatar Jul 12 '23 05:07 fuminori-ido-m