Skip to content

Commit

Permalink
fix(upload-core): IE compatibility no array spreads
Browse files Browse the repository at this point in the history
  • Loading branch information
Christie Baker authored and Christie Baker committed Jul 12, 2018
1 parent da59226 commit 7444173
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/upload-core/src/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ const defaultOptions = {
removeFingerprintOnSuccess: true,
fingerprint(file, options = {}) {
const attributes = [file.name, file.type, file.size, file.lastModified];
let attributesKey = 'tus-';
for (let i = 0; i < attributes.length; i++) {
if (attributes[i]) {
attributesKey += `${attributes[i]}-`;
}
}

const key = ['tus', ...attributes].join('-');

const keys = Object.keys(options.metadata || {}).map(
key => options.metadata[key]
);
const signature = [
...attributes,
attributes.toString().replace(/,/g, ''),
options.endpoint,
...Object.keys(options.metadata || {}).map(key => options.metadata[key]),
keys,
].join('');

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

return `${key}${print}`;
return `${attributesKey}${print}`;
},
};

Expand Down

0 comments on commit 7444173

Please sign in to comment.