Skip to content

Commit 1ac5c33

Browse files
committed
Removed decodeBase64
1 parent 9a7e85a commit 1ac5c33

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

lib/av.js

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,46 +3824,6 @@
38243824
return chunks.join("");
38253825
};
38263826

3827-
//https://raw.githubusercontent.com/kvz/phpjs/master/functions/url/base64_decode.js
3828-
var decodeBase64 = function(data) {
3829-
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
3830-
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
3831-
ac = 0,
3832-
dec = '',
3833-
tmp_arr = [];
3834-
3835-
if (!data) {
3836-
return data;
3837-
}
3838-
3839-
data += '';
3840-
3841-
do {
3842-
// unpack four hexets into three octets using index points in b64
3843-
h1 = b64.indexOf(data.charAt(i++));
3844-
h2 = b64.indexOf(data.charAt(i++));
3845-
h3 = b64.indexOf(data.charAt(i++));
3846-
h4 = b64.indexOf(data.charAt(i++));
3847-
3848-
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
3849-
3850-
o1 = bits >> 16 & 0xff;
3851-
o2 = bits >> 8 & 0xff;
3852-
o3 = bits & 0xff;
3853-
3854-
if (h3 == 64) {
3855-
tmp_arr[ac++] = String.fromCharCode(o1);
3856-
} else if (h4 == 64) {
3857-
tmp_arr[ac++] = String.fromCharCode(o1, o2);
3858-
} else {
3859-
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
3860-
}
3861-
} while (i < data.length);
3862-
3863-
dec = tmp_arr.join('');
3864-
3865-
return decodeURIComponent(escape(dec.replace(/\0+$/, '')));
3866-
};
38673827
// A list of file extensions to mime types as found here:
38683828
// http://stackoverflow.com/questions/58510/using-net-how-can-you-find-the-
38693829
// mime-type-of-a-file-based-on-the-file-signature
@@ -4147,7 +4107,6 @@
41474107
this._metaData.size = data.length;
41484108
} else if (data && data.base64) {
41494109
this._source = AV.Promise.as(data.base64, guessedType);
4150-
this._metaData.size = decodeBase64(data.base64).length;
41514110
} else if (typeof(File) !== "undefined" && data instanceof File) {
41524111
this._source = readAsync(data, type);
41534112
} else if(AV._isNode && Buffer.isBuffer(data)) {
@@ -4309,9 +4268,6 @@
43094268
self._metaData.mime_type = type;
43104269
self._qiniu_key = key;
43114270
self._base64 = base64;
4312-
if(!self._metaData.size){
4313-
self._metaData.size = decodeBase64(base64).length;
4314-
}
43154271
return AV._request("qiniu", null, null, 'POST', data);
43164272
}).then(function(response) {
43174273
self._url = response.url;
@@ -4346,9 +4302,6 @@
43464302
mime_type: type,
43474303
metaData: self._metaData,
43484304
};
4349-
if(!self._metaData.size){
4350-
self._metaData.size = decodeBase64(base64).length;
4351-
}
43524305
return AV._request("files", self._name, null, 'POST', data);
43534306
}).then(function(response) {
43544307
self._name = response.name;

0 commit comments

Comments
 (0)