Skip to content

Commit 1f668d2

Browse files
authored
Fix: Disable chunked upload in IE11 (#17)
IE11 does not work well with Rusha hashing on the main thread.
1 parent 245369d commit 1f668d2

4 files changed

Lines changed: 31 additions & 12 deletions

File tree

src/components/ContentExplorer/moreOptionsCellRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from 'react';
88
import DropdownMenu from '../DropdownMenu';
99
import { Menu, MenuItem } from '../Menu';
1010
import { Button } from '../Button';
11-
import isMobile from '../../util/mobile';
11+
import { isMobile } from '../../util/browser';
1212
import {
1313
PERMISSION_CAN_DOWNLOAD,
1414
PERMISSION_CAN_RENAME,

src/components/ContentUploader/ContentUploader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import API from '../../api';
1313
import DroppableContent from './DroppableContent';
1414
import Footer from './Footer';
1515
import makeResponsive from '../makeResponsive';
16+
import { isIE } from '../../util/browser';
1617
import {
1718
CLIENT_NAME_CONTENT_UPLOADER,
1819
DEFAULT_HOSTNAME_UPLOAD,
@@ -246,7 +247,11 @@ class ContentUploader extends Component<DefaultProps, Props, State> {
246247
uploadFile(item: UploadItem) {
247248
const { rootFolderId, chunked } = this.props;
248249
const { api, file } = item;
249-
api.getUploadAPI(chunked, file.size).upload({
250+
251+
// Disable chunked upload in IE11 for now until hashing is done in a worker
252+
const useChunked = chunked && !isIE();
253+
254+
api.getUploadAPI(useChunked, file.size).upload({
250255
id: rootFolderId,
251256
file,
252257
successCallback: (entries) => this.handleUploadSuccess(item, entries),

src/util/browser.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* @flow
3+
* @file Helper to get mobile
4+
* @author Box
5+
*/
6+
7+
/**
8+
* Returns whether browser is mobile.
9+
*
10+
* @return {boolean} Whether browser is mobile
11+
*/
12+
export function isMobile(): boolean {
13+
// Relying on the user agent to avoid desktop browsers on machines with touch screens.
14+
return /iphone|ipad|ipod|android|blackberry|bb10|mini|windows\sce|palm/i.test(navigator.userAgent);
15+
}
16+
17+
/**
18+
* Returns whether browser is IE.
19+
*
20+
* @return {boolena} Whether browser is IE
21+
*/
22+
export function isIE() {
23+
return /Trident/i.test(navigator.userAgent);
24+
}

src/util/mobile.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)