summaryrefslogtreecommitdiff
path: root/modules/file
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-10-05 21:13:49 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-10-05 21:13:49 -0700
commit925429f32a14007b99a347286bc76cd8fdef48fb (patch)
tree510852f816e64ff318c39958111482d3c6ad4e39 /modules/file
parent71c956f693985442d806621b33fb4f56ce02c801 (diff)
downloadbrdo-925429f32a14007b99a347286bc76cd8fdef48fb.tar.gz
brdo-925429f32a14007b99a347286bc76cd8fdef48fb.tar.bz2
Issue #1037632 by Sheldon Rampton, Tor Arne Thune, roy smith: Fixed Attaching a forbidden file to a node gives an error message with bogus file path.
Diffstat (limited to 'modules/file')
-rw-r--r--modules/file/file.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/file/file.js b/modules/file/file.js
index 577480bbc..0135a3b27 100644
--- a/modules/file/file.js
+++ b/modules/file/file.js
@@ -73,7 +73,14 @@ Drupal.file = Drupal.file || {
var acceptableMatch = new RegExp('\\.(' + extensionPattern + ')$', 'gi');
if (!acceptableMatch.test(this.value)) {
var error = Drupal.t("The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.", {
- '%filename': this.value,
+ // According to the specifications of HTML5, a file upload control
+ // should not reveal the real local path to the file that a user
+ // has selected. Some web browsers implement this restriction by
+ // replacing the local path with "C:\fakepath\", which can cause
+ // confusion by leaving the user thinking perhaps Drupal could not
+ // find the file because it messed up the file path. To avoid this
+ // confusion, therefore, we strip out the bogus fakepath string.
+ '%filename': this.value.replace('C:\\fakepath\\', ''),
'%extensions': extensionPattern.replace(/\|/g, ', ')
});
$(this).closest('div.form-managed-file').prepend('<div class="messages error file-upload-js-error">' + error + '</div>');