Merge pull request #28236 from element-hq/t3chguy/sonar-happy

This commit is contained in:
Michael Telatynski 2024-10-18 15:55:15 +01:00 committed by GitHub
commit 4e93233a3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 46 additions and 67 deletions

View file

@ -450,7 +450,7 @@ export const Commands = [
const matches = args.match(/^(\S+)$/);
if (matches) {
let roomAlias = matches[1];
if (roomAlias[0] !== "#") return reject(this.getUsage());
if (!roomAlias.startsWith("#")) return reject(this.getUsage());
if (!roomAlias.includes(":")) {
roomAlias += ":" + cli.getDomain();
@ -994,7 +994,7 @@ Commands.forEach((cmd) => {
export function parseCommandString(input: string): { cmd?: string; args?: string } {
// trim any trailing whitespace, as it can confuse the parser for IRC-style commands
input = input.trimEnd();
if (input[0] !== "/") return {}; // not a command
if (!input.startsWith("/")) return {}; // not a command
const bits = input.match(/^(\S+?)(?:[ \n]+((.|\n)*))?$/);
let cmd: string;