FIX: Validate asset url before replacing base url (#16438)

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
Zachary Huff
2023-01-29 18:32:48 -05:00
committed by GitHub
parent cd55d72b61
commit 0a8387ecd2
2 changed files with 9 additions and 1 deletions

View File

@ -38,7 +38,7 @@ export function getURLWithCDN(url) {
// only relative urls
if (cdn && /^\/[^\/]/.test(url)) {
url = cdn + url;
} else if (S3CDN) {
} else if (S3CDN && url.startsWith(S3BaseUrl)) {
url = url.replace(S3BaseUrl, S3CDN);
}
return url;