From 19038a054274aaffd5e416b0912e5fb3d8a12d0b Mon Sep 17 00:00:00 2001 From: Faey Umbrea <1144986+FaeyUmbrea@users.noreply.github.com> Date: Sat, 17 Jun 2023 10:13:36 +0200 Subject: [PATCH] Fixing some wierd edge case --- scripts/module.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/module.js b/scripts/module.js index d06fa36..4b27a20 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -131,8 +131,15 @@ class S3Utils { * @returns string */ static transformURL(url) { - if(game.settings.get('s3-path-url', "custom_style")&&url.startsWith(prevHref)){ - return url.replace(prevHref,game.data.files.s3.endpoint.href); + const splitHref = prevHref.split('//') + if(game.settings.get('s3-path-url', "custom_style")) { + if (url.startsWith(prevHref)) { + return url.replace(prevHref, game.data.files.s3.endpoint.href); + } + if (url.includes(splitHref[1])){ + // if URL has been mangled by some other module, discard anything before the href without the protocol. + return game.data.files.s3.endpoint.href + url.split(splitHref[1])[1]; + } } return url;