user notification for file uploads > 4GB in IE11 #27004

Merged
merged 1 commit into from Jan 24, 2017

Projects

None yet

7 participants

@hurradieweltgehtunter

Description

Notify users with IE11 to use desktop client for uploading files bigger than 4GB.

Related Issue

owncloud/enterprise#1779

Motivation and Context

IE11 can't handle file uploads bigger than 4GB

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
@hurradieweltgehtunter hurradieweltgehtunter self-assigned this Jan 23, 2017
@CLAassistant
CLAassistant commented Jan 23, 2017 edited

CLA assistant check
All committers have signed the CLA.

@mention-bot

@hurradieweltgehtunter, thanks for your PR! By analyzing the history of the files in this pull request, we identified @butonic, @PVince81 and @DeepDiver1975 to be potential reviewers.

apps/files/js/file-upload.js
+ ieversion = 0;
+
+ var ua = window.navigator.userAgent;
+ var trident = ua.indexOf('Trident/');
@DeepDiver1975
DeepDiver1975 Jan 23, 2017 Member

please fix indent - we use tabs

apps/files/js/file-upload.js
+ if (file.size > 4187593113) {
+ data.textStatus = 'sizeexceedbrowserlimit';
+ data.errorThrown = t('files',
+ 'Total file size {size1} exceeds your browser upload limit. Please use the owncloud desktop client to upload files bigger than 4GB.', {
@DeepDiver1975
DeepDiver1975 Jan 23, 2017 Member

owncloud has to be passed in as argument due to whitelabling

apps/files/l10n/en_GB.js
@@ -28,6 +28,7 @@ OC.L10N.register(
"Upload cancelled." : "Upload cancelled.",
"Unable to upload {filename} as it is a directory or has 0 bytes" : "Unable to upload {filename} as it is a directory or has 0 bytes",
"Total file size {size1} exceeds upload limit {size2}" : "Total file size {size1} exceeds upload limit {size2}",
+ "Total file size {size1} exceeds your browser upload limit. Please use the owncloud desktop client to upload files bigger than 4GB." : "Total file size {size1} exceeds your browser upload limit. Please use the owncloud desktop client to upload files bigger than 4GB.",
@DeepDiver1975
DeepDiver1975 Jan 23, 2017 Member

please remove - translations are handled via tranisfex

apps/files/l10n/en_GB.json
@@ -26,6 +26,7 @@
"Upload cancelled." : "Upload cancelled.",
"Unable to upload {filename} as it is a directory or has 0 bytes" : "Unable to upload {filename} as it is a directory or has 0 bytes",
"Total file size {size1} exceeds upload limit {size2}" : "Total file size {size1} exceeds upload limit {size2}",
+ "Total file size {size1} exceeds your browser upload limit. Please use the owncloud desktop client to upload files bigger than 4GB." : "Total file size {size1} exceeds your browser upload limit. Please use the owncloud desktop client to upload files bigger than 4GB.",
@DeepDiver1975
DeepDiver1975 Jan 23, 2017 Member

please remove - translations are handled via tranisfex

@DeepDiver1975 DeepDiver1975 added this to the 9.1.4 milestone Jan 23, 2017
@michaelstingl

@hurradieweltgehtunter Plz check if your size calculation matches the one from ownCloud.

@DeepDiver1975
Member
  • please add unit tests
  • generally speaking we implement new features and fixes on master and backport later - please respect this next time - THX
  • please click on the CLA button - THX
apps/files/js/file-upload.js
@@ -336,6 +336,35 @@ OC.Upload = {
data.errorThrown = errorMessage;
}
+ // detect browser and version to handle IE11 upload file size limit
+ // $.browser detects "mozilla" for IE11, which in this case we use window.navigator.userAgent
+ ie = false;
@PVince81
PVince81 Jan 23, 2017 Collaborator

use var to declare these variables locally, else they'd be global

apps/files/js/file-upload.js
+ }
+
+ // check browser and version
+ if (ie && ieversion == 11) {
@PVince81
PVince81 Jan 23, 2017 Collaborator

if we're doing this often, might be worth adding this as utility function to the OC.Util namespace which is currently in core/js/js.js (there is already a isIE() function there)

apps/files/js/file-upload.js
+ 'size1': humanFileSize(file.size)
+ });
+ }
+ }
@PVince81
PVince81 Jan 23, 2017 Collaborator

weird indents

@michaelstingl

@DeepDiver1975 Fix shouldn't be required for oC 10 (#26306)

apps/files/js/file-upload.js
+ // detect browser and version to handle IE11 upload file size limit
+ if (OC.Util.isIE11()) {
+ // Check for the various File API support.
+ if (window.File && window.FileReader && window.FileList && window.Blob) {
@PVince81
PVince81 Jan 23, 2017 Collaborator

Is this really required or can we assume that IE11 has these ?

@PVince81
PVince81 Jan 24, 2017 Collaborator

This is completely unneeded because none of the checks below is using any of these APIs.

I'll remove it.

apps/files/js/file-upload.js
@@ -583,7 +601,7 @@ OC.Upload = {
+ '</span><span class="mobile">'
+ t('files', '...')
+ '</span></em>');
- $('#uploadprogressbar').tipsy({gravity:'n', fade:true, live:true});
+ $('#uploadprogressbar').tipsy({gravity:'n', fade:true, live:true});
@PVince81
PVince81 Jan 23, 2017 Collaborator

@hurradieweltgehtunter mind fixing this bad indent as well ?

@PVince81
Collaborator

I'll take care of the unit tests, it's a bit complicated.

apps/files/js/file-upload.js
+ data.errorThrown = t('files',
+ 'Total file size {size1} exceeds your browser upload limit. Please use the {ownCloud} desktop client to upload files bigger than {size2}.', {
+ 'size1': humanFileSize(file.size),
+ 'ownCloud' : 'ownCloud',
@PVince81
PVince81 Jan 23, 2017 Collaborator

needs to use product name in case of white labeling

@PVince81
Collaborator

Added missing tests and fix theme name thingy

@PVince81
Collaborator

@michaelstingl @davitol can you help test this in IE11 and non-IE11 envs with big files ?

@DeepDiver1975
Member

@hurradieweltgehtunter any please squash your 4 commits into one - thx

@hurradieweltgehtunter @PVince81 hurradieweltgehtunter added user notification for file uploads > 4GB in IE11
5e4f2b2
@PVince81
Collaborator
PVince81 commented Jan 24, 2017 edited

Rebased and squashed.

Please review and test.

@davitol
Contributor
davitol commented Jan 24, 2017 edited

๐Ÿ‘ "Total file size 3.9 GB exceeds your browser upload limit. Please use the ownCloud desktop client to upload files bigger than 3.9 GB." message appears

@PVince81
Collaborator

Travis, what's taking you so long ? Even Jenkins was faster...

Anyway, Travis doesn't contain any JS related tests. Merging.

@PVince81 PVince81 merged commit 32b5c6c into stable9.1 Jan 24, 2017

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
@PVince81 PVince81 deleted the stable9.1-IE-large-file-notification branch Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment