Fix #833 issue with files with accented chars

This commit is contained in:
Flavio Copes
2016-10-21 17:57:54 +02:00
parent 52c7ac956e
commit ed3a83345c
2 changed files with 15 additions and 10 deletions

View File

@@ -166,6 +166,11 @@ export default class FilesField {
}
}
b64_to_utf8(str) {
str = str.replace(/\s/g, '');
return decodeURIComponent(escape(window.atob(str)));
}
onDropzoneRemovedFile(file, ...extra) {
if (!file.accepted || file.rejected) { return; }
let url = file.removeUrl || this.urls.delete;
@@ -180,7 +185,7 @@ export default class FilesField {
request(url, { method: 'post', body }, () => {
if (!path) { return; }
path = global.atob(path[1]);
path = this.b64_to_utf8(path[1]);
let input = this.container.find('[name][type="hidden"]');
let data = JSON.parse(input.val() || '{}');
delete data[path];

File diff suppressed because one or more lines are too long