Skip to content

Commit

Permalink
Fixing some wierd edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
FaeyUmbrea committed Jun 17, 2023
1 parent bbbf17e commit 19038a0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 19038a0

Please sign in to comment.