Skip to content

Commit 87c135e

Browse files
authored
Merge pull request #133 from livehigh/fix/navigator-not-support
fix:兼容编译环境不支持navigator对象
2 parents 35b6d19 + e368900 commit 87c135e

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

dist/cos-js-sdk-v5.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,14 @@ var fileSliceNeedCopy = function () {
300300
return 0;
301301
};
302302
var check = function (ua) {
303+
if (!ua) return false;
303304
var ChromeVersion = (ua.match(/Chrome\/([.\d]+)/) || [])[1];
304305
var QBCoreVersion = (ua.match(/QBCore\/([.\d]+)/) || [])[1];
305306
var QQBrowserVersion = (ua.match(/QQBrowser\/([.\d]+)/) || [])[1];
306307
var need = ChromeVersion && compareVersion(ChromeVersion, '53.0.2785.116') < 0 && QBCoreVersion && compareVersion(QBCoreVersion, '3.53.991.400') < 0 && QQBrowserVersion && compareVersion(QQBrowserVersion, '9.0.2524.400') <= 0 || false;
307308
return need;
308309
};
309-
return check(navigator && navigator.userAgent);
310+
return check(typeof navigator !== 'undefined' && navigator.userAgent);
310311
}();
311312

312313
// 获取文件分片
@@ -2453,7 +2454,7 @@ COS.util = {
24532454
json2xml: util.json2xml
24542455
};
24552456
COS.getAuthorization = util.getAuth;
2456-
COS.version = '1.3.1';
2457+
COS.version = '1.3.2';
24572458

24582459
module.exports = COS;
24592460

dist/cos-js-sdk-v5.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-js-sdk-v5",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)",
55
"main": "index.js",
66
"types": "index.d.ts",

src/cos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ COS.util = {
6969
json2xml: util.json2xml,
7070
};
7171
COS.getAuthorization = util.getAuth;
72-
COS.version = '1.3.1';
72+
COS.version = '1.3.2';
7373

7474
module.exports = COS;

src/util.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ var fileSliceNeedCopy = (function () {
235235
return 0;
236236
};
237237
var check = function (ua) {
238+
if (!ua) return false;
238239
var ChromeVersion = (ua.match(/Chrome\/([.\d]+)/) || [])[1];
239240
var QBCoreVersion = (ua.match(/QBCore\/([.\d]+)/) || [])[1];
240241
var QQBrowserVersion = (ua.match(/QQBrowser\/([.\d]+)/) || [])[1];
@@ -243,7 +244,7 @@ var fileSliceNeedCopy = (function () {
243244
&& QQBrowserVersion && compareVersion(QQBrowserVersion, '9.0.2524.400') <= 0 || false;
244245
return need;
245246
};
246-
return check(navigator && navigator.userAgent);
247+
return check(typeof navigator !== 'undefined' && navigator.userAgent);
247248
})();
248249

249250
// 获取文件分片

0 commit comments

Comments
 (0)