Skip to content

Commit

Permalink
Inverting how the variables are set. Custom URL now requires specifyi…
Browse files Browse the repository at this point in the history
…ng the protocol.
  • Loading branch information
FaeyUmbrea committed Jun 17, 2023
1 parent 19038a0 commit ebbc6a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class S3Utils {
prevHostname = game.data.files.s3.endpoint.hostname;
prevProtocol = game.data.files.s3.endpoint.protocol;

game.data.files.s3.endpoint.hostname = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX);
game.data.files.s3.endpoint.host = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX);
game.data.files.s3.endpoint.href = game.data.files.s3.endpoint.protocol + "//" + game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX);
game.data.files.s3.endpoint.protocol = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX).split(':')[0]+":";
game.data.files.s3.endpoint.hostname = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX).split("//")[1];
game.data.files.s3.endpoint.host = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX).split("//")[1];
game.data.files.s3.endpoint.href = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX);
game.data.files.s3.endpoint.protocol = game.settings.get(this.ID, this.SETTINGS.CUSTOM_PREFIX).split('//')[0];
}

}
Expand Down Expand Up @@ -138,7 +138,9 @@ class S3Utils {
}
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];
let path = url.split(splitHref[1])[1]
path = path.startsWith("/") ? path : "/" + path;
return game.data.files.s3.endpoint.href + path;
}
}

Expand Down

0 comments on commit ebbc6a1

Please sign in to comment.