File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -334,19 +334,22 @@ module.exports = {
334
334
var matches = document . cookie . match ( "(^|;) ?" + encodeURIComponent ( key ) + "=([^;]*)(;|$)" ) ;
335
335
return matches ? decodeURIComponent ( matches [ 2 ] ) : "" ;
336
336
} ,
337
+ // case1: /v1/tenants/5323/mediafiles/08d3d9bf-5507-4115-a6e6-1b50b0585f99MTAzZWQ2ZjUxNjczZmM2MjY2YmE4MGMyNDNhMGI1OWMucG5n/cutout?arg=114_0_305_305_300_300
337
338
getAvatarsFullPath : function ( url , domain ) {
338
- // 以前头像上传到阿里云的oss,那时阿里云的oss不支持https
339
- // 此处的逻辑是检测到阿里云的地址如果没有使用ossimages代理则加个代理
340
- // todo: 现在已经不使用这种逻辑了,但是为了兼容老数据所以没删除
341
- // 让运维洗一下数据,这部分逻辑就可以去掉了
342
-
343
- if ( ! url ) return ;
344
-
345
- url = url . replace ( / ^ ( h t t p s ? : ) ? \/ \/ ? / , "" ) ;
339
+ // 阿里云的 oss 不支持 https,需要使用 ossimages 代理
340
+ // 现在已经不使用这种逻辑了,但是为了兼容老数据所以没删除
341
+ if ( ! url ) return "" ;
342
+ var hasProtocol = / ^ ( h t t p s ? : ) ? \/ \/ / . test ( url ) ;
346
343
var isKefuAvatar = ~ url . indexOf ( "img-cn" ) ;
347
344
var ossImg = ~ url . indexOf ( "ossimages" ) ;
348
-
349
- return isKefuAvatar && ! ossImg ? domain + "/ossimages/" + url : "//" + url ;
345
+ url = url . replace ( / ^ ( h t t p s ? : ) ? \/ \/ ? / , "" ) ;
346
+ if ( isKefuAvatar && ! ossImg ) {
347
+ return domain + "/ossimages/" + url ;
348
+ }
349
+ else if ( ! hasProtocol ) {
350
+ return domain + "/" + url ;
351
+ }
352
+ return "//" + url ;
350
353
} ,
351
354
copy : function ( obj ) {
352
355
// todo:移到,easemob.js 里边
You can’t perform that action at this time.
0 commit comments