diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-09 23:32:12 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-09 23:32:12 +0200 |
commit | e8be2ac55492a7e4f141d3bb7e6698783bef454c (patch) | |
tree | 66fb9f60f8b57b0486387ea84e3be880ba8d1ca5 | |
parent | 2fc9e27ceddf9d632d79916a71f9100138bb685f (diff) | |
download | nextcloud-server-e8be2ac55492a7e4f141d3bb7e6698783bef454c.tar.gz nextcloud-server-e8be2ac55492a7e4f141d3bb7e6698783bef454c.zip |
In cases folder drag and drop is not supported a proper message is displayed
-rw-r--r-- | apps/files/js/file-upload.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 46a53208406..070314a1188 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -242,11 +242,18 @@ OC.Upload = { data.errorThrown = errorMessage; } - if (file.type === '' && file.size === 4096) { - data.textStatus = 'dirorzero'; - data.errorThrown = t('files', 'Unable to upload {filename} as it is a directory or has 0 bytes', - {filename: file.name} - ); + // in case folder drag and drop is not supported file will point to a directory + if (!file.type && file.size%4096 === 0 && file.size <= 102400) { + try { + reader = new FileReader(); + reader.readAsBinaryString(f); + } catch (NS_ERROR_FILE_ACCESS_DENIED) { + //file is a directory + data.textStatus = 'dirorzero'; + data.errorThrown = t('files', 'Unable to upload {filename} as it is a directory or has 0 bytes', + {filename: file.name} + ); + } } // add size |