|
|
|
|
@ -370,10 +370,19 @@
|
|
|
|
|
if (!content || typeof content !== 'string') {
|
|
|
|
|
return content;
|
|
|
|
|
}
|
|
|
|
|
// 替换 ../storage/files/ 开头的路径(先处理相对路径,避免和绝对路径冲突)
|
|
|
|
|
content = content.replace(/(["'=:])(\.\.\/storage\/files\/)([^"'\s<>]+)/g, `$1${this.baseUrl}/storage/files/$3`);
|
|
|
|
|
// 替换 /storage/files/ 开头的路径
|
|
|
|
|
content = content.replace(/(["'=:])(\/storage\/files\/)([^"'\s<>]+)/g, `$1${this.baseUrl}/storage/files/$3`);
|
|
|
|
|
// 替换 ../storage/files/ 开头的路径(相对路径)
|
|
|
|
|
content = content.replace(/(["'=])(\.\.\/storage\/files\/)([^"'\s<>]+)/g, `$1${this.baseUrl}/storage/files/$3`);
|
|
|
|
|
// 替换 /storage/files/ 开头的路径(排除http://或https://后的完整URL)
|
|
|
|
|
content = content.replace(/(["'=])(\/storage\/files\/)([^"'\s<>]+)/g, function(match, p1, p2, p3, offset, string) {
|
|
|
|
|
// 检查前面是否有http://或https://(最多往前检查30个字符)
|
|
|
|
|
var beforeMatch = string.substring(Math.max(0, offset - 30), offset);
|
|
|
|
|
// 如果前面有完整的URL协议,说明已经是完整URL,不替换
|
|
|
|
|
if (/https?:\/\/[^"'\s<>]*$/.test(beforeMatch)) {
|
|
|
|
|
return match;
|
|
|
|
|
}
|
|
|
|
|
// 否则替换为完整URL
|
|
|
|
|
return p1 + this.baseUrl + '/storage/files/' + p3;
|
|
|
|
|
}.bind(this));
|
|
|
|
|
return content;
|
|
|
|
|
},
|
|
|
|
|
// 跳转微信客服
|
|
|
|
|
|