aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-04-09 23:32:12 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-04-09 23:32:12 +0200
commite8be2ac55492a7e4f141d3bb7e6698783bef454c (patch)
tree66fb9f60f8b57b0486387ea84e3be880ba8d1ca5
parent2fc9e27ceddf9d632d79916a71f9100138bb685f (diff)
downloadnextcloud-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.js17
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