File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1041,7 +1041,7 @@ function sliceCopyFile(params, callback) {
10411041
10421042 FileSize = params . FileSize = data . headers [ 'content-length' ] ;
10431043 if ( FileSize === undefined || ! FileSize ) {
1044- callback ( util . error ( new Error ( 'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.' ) ) ) ;
1044+ callback ( util . error ( new Error ( 'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 ) ' ) ) ) ;
10451045 return ;
10461046 }
10471047
@@ -1148,7 +1148,7 @@ function downloadFile(params, callback) {
11481148 // 获取文件大小
11491149 FileSize = params . FileSize = parseInt ( data . headers [ 'content-length' ] ) ;
11501150 if ( FileSize === undefined || ! FileSize ) {
1151- callback ( util . error ( new Error ( 'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.' ) ) ) ;
1151+ callback ( util . error ( new Error ( 'get Content-Length error, please add "Content-Length" to CORS ExposeHeader setting.( 获取Content-Length失败,请在CORS ExposeHeader设置中添加Content-Length,请参考文档:https://cloud.tencent.com/document/product/436/13318 ) ' ) ) ) ;
11521152 return ;
11531153 }
11541154
Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ var COS = function (options) {
5959 if ( this . options . AppId ) {
6060 console . warn ( 'warning: AppId has been deprecated, Please put it at the end of parameter Bucket(E.g: "test-1250000000").' ) ;
6161 }
62+ if ( util . isWeb ( ) ) {
63+ console . warn ( 'warning: cos-nodejs-sdk-v5 不支持浏览器使用,请改用 cos-js-sdk-v5,参考文档: https://cloud.tencent.com/document/product/436/11459' ) ;
64+ console . warn ( 'warning: cos-nodejs-sdk-v5 does not support browsers. Please use cos-js-sdk-v5 instead, See: https://cloud.tencent.com/document/product/436/11459' ) ;
65+ }
6266 event . init ( this ) ;
6367 task . init ( this ) ;
6468} ;
Original file line number Diff line number Diff line change @@ -625,6 +625,10 @@ var error = function (err, opt) {
625625 return err ;
626626}
627627
628+ var isWeb = function ( ) {
629+ return typeof window === 'object' ;
630+ }
631+
628632var util = {
629633 noop : noop ,
630634 formatParams : formatParams ,
@@ -657,6 +661,7 @@ var util = {
657661 getV4Auth : getV4Auth ,
658662 isBrowser : false ,
659663 obj2str : obj2str ,
664+ isWeb : isWeb ,
660665} ;
661666
662667module . exports = util ;
You can’t perform that action at this time.
0 commit comments