Skip to content

Commit d7a98fe

Browse files
authored
Handle trailing dot FQDNs for domain-specific config.json files (#25351)
1 parent 9457af2 commit d7a98fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vector/getconfig.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ import type { IConfigOptions } from "matrix-react-sdk/src/IConfigOptions";
2121
export async function getVectorConfig(relativeLocation = ""): Promise<IConfigOptions | undefined> {
2222
if (relativeLocation !== "" && !relativeLocation.endsWith("/")) relativeLocation += "/";
2323

24-
const specificConfigPromise = getConfig(`${relativeLocation}config.${window.location.hostname}.json`);
24+
// Handle trailing dot FQDNs
25+
let domain = window.location.hostname.trimEnd();
26+
if (domain[domain.length - 1] === ".") {
27+
domain = domain.slice(0, -1);
28+
}
29+
30+
const specificConfigPromise = getConfig(`${relativeLocation}config.${domain}.json`);
2531
const generalConfigPromise = getConfig(relativeLocation + "config.json");
2632

2733
try {

0 commit comments

Comments
 (0)