summaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-03-23 17:18:46 +0100
committerLukas Reschke <lukas@owncloud.com>2015-03-23 17:18:46 +0100
commit02c0fe8d43d409797162b71dbacd1565976b128c (patch)
treea43f9de09a663ec83e6a8a24275206a5e71ff342 /apps/files/js/file-upload.js
parent0adcb99110b96f310d6530b33b55c9e58abeb213 (diff)
parent4e18b52527696cc61ad351bf6a761abacf116890 (diff)
downloadnextcloud-server-02c0fe8d43d409797162b71dbacd1565976b128c.tar.gz
nextcloud-server-02c0fe8d43d409797162b71dbacd1565976b128c.zip
Merge pull request #13941 from owncloud/fix-folder-upload-on-firefox
Show message if upload of folder isn't allowed
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 4e0b9e0e6d1..6b0cae209c2 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -266,11 +266,20 @@ OC.Upload = {
// in case folder drag and drop is not supported file will point to a directory
// http://stackoverflow.com/a/20448357
if ( ! file.type && file.size%4096 === 0 && file.size <= 102400) {
+ var dirUploadFailure = false;
try {
var reader = new FileReader();
reader.readAsBinaryString(file);
} catch (NS_ERROR_FILE_ACCESS_DENIED) {
//file is a directory
+ dirUploadFailure = true;
+ }
+ if (file.size === 0) {
+ // file is empty or a directory
+ dirUploadFailure = true;
+ }
+
+ if (dirUploadFailure) {
data.textStatus = 'dirorzero';
data.errorThrown = t('files',
'Unable to upload {filename} as it is a directory or has 0 bytes',