Skip to content

Commit

Permalink
Merge pull request #3 from wake/main
Browse files Browse the repository at this point in the history
Encode filename in EmoFormData with encodeURIComponent
  • Loading branch information
yaleiyale authored Apr 11, 2024
2 parents bc212aa + 2a18e60 commit bea2700
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/emo-formdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class EmoFormData {
this.body.push(data.charCodeAt(i))
}
} else if (value instanceof File) { // add files
data += 'Content-Disposition: form-data; name="' + name + '"; filename="' + value.name + '"\r\n'
data += 'Content-Disposition: form-data; name="' + name + '"; filename="' + encodeURIComponent(value.name) + '"\r\n'
data += 'Content-Type: ' + value.type + '\r\n\r\n'
for (let i = 0; i < data.length; i++) {
this.body.push(data.charCodeAt(i))
Expand Down

0 comments on commit bea2700

Please sign in to comment.