Skip to content

Commit

Permalink
Clean filename before presenting it to error modal
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Jan 21, 2022
1 parent d99bc36 commit d610d6c
Show file tree
Hide file tree
Showing 3 changed files with 104,475 additions and 5,741 deletions.
8 changes: 5 additions & 3 deletions themes/grav/app/forms/fields/files.js
Expand Up @@ -224,7 +224,7 @@ export default class FilesField {
file,
data: response,
mode: 'removeFile',
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD} <strong>${file.name}</strong></p>
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD} <strong>{{fileName}}</strong></p>
<pre>${response.message}</pre>`
});
}
Expand All @@ -240,7 +240,7 @@ export default class FilesField {
file,
data,
mode: 'removeFile',
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_ADD} <strong>${file.name}</strong></p>
msg: `<p>${translations.PLUGIN_ADMIN.FILE_ERROR_ADD} <strong>{{fileName}}</strong></p>
<pre>${data.message}</pre>`
});
}
Expand Down Expand Up @@ -325,7 +325,9 @@ export default class FilesField {
}

let modal = $('[data-remodal-id="generic"]');
modal.find('.error-content').html(msg);
const cleanName = file.name.replace('<', '&lt;').replace('>', '&gt;');

modal.find('.error-content').html(msg.replace('{{fileName}}', cleanName));
$.remodal.lookup[modal.data('remodal')].open();
}
}
Expand Down

0 comments on commit d610d6c

Please sign in to comment.