Skip to content

Commit 7444173

Browse files
Christie BakerChristie Baker
authored andcommitted
fix(upload-core): IE compatibility no array spreads
1 parent da59226 commit 7444173

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/upload-core/src/upload.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,25 @@ const defaultOptions = {
1717
removeFingerprintOnSuccess: true,
1818
fingerprint(file, options = {}) {
1919
const attributes = [file.name, file.type, file.size, file.lastModified];
20+
let attributesKey = 'tus-';
21+
for (let i = 0; i < attributes.length; i++) {
22+
if (attributes[i]) {
23+
attributesKey += `${attributes[i]}-`;
24+
}
25+
}
2026

21-
const key = ['tus', ...attributes].join('-');
22-
27+
const keys = Object.keys(options.metadata || {}).map(
28+
key => options.metadata[key]
29+
);
2330
const signature = [
24-
...attributes,
31+
attributes.toString().replace(/,/g, ''),
2532
options.endpoint,
26-
...Object.keys(options.metadata || {}).map(key => options.metadata[key]),
33+
keys,
2734
].join('');
2835

2936
const print = Math.abs(hashCode(signature));
3037

31-
return `${key}${print}`;
38+
return `${attributesKey}${print}`;
3239
},
3340
};
3441

0 commit comments

Comments
 (0)