diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-02-06 11:15:09 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-02-06 11:15:09 +0100 |
commit | 4e18b52527696cc61ad351bf6a761abacf116890 (patch) | |
tree | 9708eac5c9221652fd2f7e17b9b3fb72a839ead9 /apps/files/js | |
parent | bd60abbefc45f7fe1dce4ab0259b7be0f1ec515e (diff) | |
download | nextcloud-server-4e18b52527696cc61ad351bf6a761abacf116890.tar.gz nextcloud-server-4e18b52527696cc61ad351bf6a761abacf116890.zip |
Show message if upload of folder isn't allowed
* current firefox doesn't throw an exception anymore
* it just reads 0 bytes -> folder or empty file
* upload of folder or empty file isn't supported in every
browser except Chrome
* fixes #13940
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/file-upload.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 7374a4c90f3..bc3e59a11af 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', |