master
lion 3 months ago
parent fc9c22e27f
commit 304bdb993d

@ -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);
// URLURL
if (/https?:\/\/[^"'\s<>]*$/.test(beforeMatch)) {
return match;
}
// URL
return p1 + this.baseUrl + '/storage/files/' + p3;
}.bind(this));
return content;
},
//

Loading…
Cancel
Save