Make sonarcloud happier

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-07-31 11:03:18 +01:00
parent 26ac7462fd
commit d5f4b1bc86
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
4 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ export async function getVectorConfig(relativeLocation = ""): Promise<IConfigOpt
// Handle trailing dot FQDNs
let domain = window.location.hostname.trimEnd();
if (domain[domain.length - 1] === ".") {
if (domain.endsWith(".")) {
domain = domain.slice(0, -1);
}

View file

@ -5,7 +5,7 @@
if (window.localStorage) {
Object.keys(window.localStorage).forEach((key) => {
if (key.indexOf("loglevel:") === 0) {
if (key.startsWith("loglevel:")) {
window.localStorage.removeItem(key);
}
});

View file

@ -70,7 +70,7 @@ async function initPage(): Promise<void> {
try {
const result = await fetch(`https://${serverName}/.well-known/matrix/client`);
const wkConfig = await result.json();
if (wkConfig && wkConfig["m.homeserver"]) {
if (wkConfig?.["m.homeserver"]) {
hsUrl = wkConfig["m.homeserver"]["base_url"];
if (wkConfig["m.identity_server"]) {
@ -78,7 +78,7 @@ async function initPage(): Promise<void> {
}
}
} catch (e) {
if (wkConfig && wkConfig["m.homeserver"]) {
if (wkConfig?.["m.homeserver"]) {
hsUrl = wkConfig["m.homeserver"]["base_url"] || undefined;
if (wkConfig["m.identity_server"]) {