Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uri-encode filename because of rfc6266 section-4.3 #2245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fuminori-ido-m
Copy link

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant