Skip to content

Commit 957dee3

Browse files
committed
Upgrade CryptoJS to official mirror, use base64 polyfill and log fatal errors.
1 parent e10618e commit 957dee3

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

Gruntfile.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,13 @@ module.exports = function(grunt) {
8383
'LICENSE',
8484
'libs/underscore/underscore-min.js',
8585
'libs/underscore/underscore-min.map',
86-
'libs/cryptojslib/rollups/md5.js',
87-
'libs/cryptojslib/components/lib-typedarrays-min.js',
88-
'libs/cryptojslib/components/enc-base64-min.js',
86+
'libs/crypto-js/crypto-js.js',
87+
'libs/crypto-js/md5.js',
88+
'libs/crypto-js/lib-typedarrays.js',
89+
'libs/crypto-js/enc-base64.js',
8990
'libs/atomic/dist/atomic.min.js',
90-
'libs/q/q.js'
91+
'libs/q/q.js',
92+
'libs/base-64/base64.js'
9193
]
9294
}]
9395
}

app/azureBlobUploadWorker.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
state.blocks.push({
295295
index: index,
296296
blockId: blockId,
297-
blockIdBase64: btoa(blockId),
297+
blockIdBase64: base64.encode(blockId),
298298
pointer: pointer,
299299
size: (end - pointer),
300300
end: end,
@@ -437,17 +437,27 @@
437437
};
438438

439439
addLib('underscore/underscore-min.js');
440-
addLib('cryptojslib/rollups/md5.js');
441-
addLib('cryptojslib/components/lib-typedarrays-min.js');
442-
addLib('cryptojslib/components/enc-base64-min.js');
440+
addLib('crypto-js/crypto-js.js');
441+
addLib('crypto-js/md5.js');
442+
addLib('crypto-js/lib-typedarrays.js');
443+
addLib('crypto-js/enc-base64.js');
443444
addLib('atomic/dist/atomic.min.js');
444445
addLib('q/q.js');
446+
addLib('base-64/base64.js');
445447
}
446448

447449
function notifyReady() {
448450
self.postMessage({ type: 'ready' });
449451
}
450452

453+
function doUpload() {
454+
try {
455+
upload();
456+
} catch(err) {
457+
$log.error(err);
458+
}
459+
}
460+
451461
self.onmessage = function(e) {
452462

453463
switch (e.data.type) {
@@ -465,7 +475,7 @@
465475
notifyReady();
466476
break;
467477
case 'upload':
468-
upload();
478+
doUpload();
469479
break;
470480
case 'cancel':
471481
state.cancelled = true;

bower.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"name": "angular-azure-blob",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"dependencies": {
55
"angular": "latest",
66
"underscore": "latest",
7-
"cryptojslib": "latest",
7+
"crypto-js": "latest",
88
"q": "1.0.1",
9-
"atomic": "[email protected]:sjdweb/atomic.git"
9+
"atomic": "[email protected]:sjdweb/atomic.git",
10+
"base-64": "latest"
1011
},
1112
"devDependencies": {
1213
"angular-mocks": "latest"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-azure-blob",
3-
"version": "0.0.6",
3+
"version": "0.0.7",
44
"description": "Angular Azure blob upload helper",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1"

0 commit comments

Comments
 (0)