Skip to content

Commit

Permalink
Handle trailing dot FQDNs for domain-specific config.json files (#25351)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored May 12, 2023
1 parent 9457af2 commit d7a98fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vector/getconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ import type { IConfigOptions } from "matrix-react-sdk/src/IConfigOptions";
export async function getVectorConfig(relativeLocation = ""): Promise<IConfigOptions | undefined> {
if (relativeLocation !== "" && !relativeLocation.endsWith("/")) relativeLocation += "/";

const specificConfigPromise = getConfig(`${relativeLocation}config.${window.location.hostname}.json`);
// Handle trailing dot FQDNs
let domain = window.location.hostname.trimEnd();
if (domain[domain.length - 1] === ".") {
domain = domain.slice(0, -1);
}

const specificConfigPromise = getConfig(`${relativeLocation}config.${domain}.json`);
const generalConfigPromise = getConfig(relativeLocation + "config.json");

try {
Expand Down

0 comments on commit d7a98fe

Please sign in to comment.