Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-04-24 08:36:41 +0300
committerGitHub <noreply@github.com>2020-04-24 08:36:41 +0300
commit10b7463468623683385f3a394372427a269a681f (patch)
tree4d5e1ff304ff63ea7089e352642ac0c526012c3d /apps/files
parent0bd91e2b16754387c0a6db5247f815eac47aba58 (diff)
parentb417f92e8edeb3f056964e33549dd89563d62d69 (diff)
Merge pull request #20604 from nextcloud/backport/20595/stable16
[stable16] Fix IE11 upload fallback methods
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/js/file-upload.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index c7174d31848..3371e4d2118 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -44,6 +44,28 @@ OC.FileUpload = function(uploader, data) {
OC.FileUpload.CONFLICT_MODE_DETECT = 0;
OC.FileUpload.CONFLICT_MODE_OVERWRITE = 1;
OC.FileUpload.CONFLICT_MODE_AUTORENAME = 2;
+
+// IE11 polyfill
+// TODO: nuke out of orbit as well as this legacy code
+if (!FileReader.prototype.readAsBinaryString) {
+ FileReader.prototype.readAsBinaryString = function(fileData) {
+ var binary = ''
+ var pt = this
+ var reader = new FileReader()
+ reader.onload = function (e) {
+ var bytes = new Uint8Array(reader.result)
+ var length = bytes.byteLength
+ for (var i = 0; i < length; i++) {
+ binary += String.fromCharCode(bytes[i])
+ }
+ // pt.result - readonly so assign binary
+ pt.content = binary
+ $(pt).trigger('onload')
+ }
+ reader.readAsArrayBuffer(fileData)
+ }
+}
+
OC.FileUpload.prototype = {
/**
@@ -938,12 +960,13 @@ OC.Uploader.prototype = _.extend({
// 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) {
+ 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) {
+ } catch (error) {
+ console.log(reader, error)
//file is a directory
dirUploadFailure = true;
}
@@ -1059,6 +1082,7 @@ OC.Uploader.prototype = _.extend({
message = response.message;
}
}
+ console.error(e, data, response)
OC.Notification.show(message || data.errorThrown, {type: 'error'});
}