Skip to content

Commit b80b25b

Browse files
authored
Merge pull request #1973 from gitgitgadget/some-fixes
Some more fixes ;-)
2 parents fd54c52 + cc78f8c commit b80b25b

File tree

9 files changed

+10
-3
lines changed

9 files changed

+10
-3
lines changed

lib/ci-helper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,13 +541,13 @@ export class CIHelper {
541541
}
542542
}
543543

544-
const match = comment.body.match(/^\s*(\/[-a-z]+)(\s+(.*?))?\s*$/);
544+
const match = comment.body.trim().match(/^(\/[-a-z]+)\s*(.*)$/);
545545
if (!match) {
546546
console.log(`Not a command; doing nothing: '${comment.body}'`);
547547
return; /* nothing to do */
548548
}
549549
const command = match[1];
550-
const argument = match[3];
550+
const argument = match[2].trim();
551551
const prKey = {
552552
owner: repositoryOwner,
553553
repo: this.config.repo.name,

lib/git-notes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export class GitNotes {
219219
continue;
220220
}
221221

222+
// eslint-disable-next-line security/detect-unsafe-regex
222223
const removeAdd = split[i + 6].match(/^(?:-(.*)\n)?\+(.*)$/);
223224
if (!removeAdd) throw new Error(`Not a single modified line?\n${split[i + 6]}`);
224225

lib/mail-archive-helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ export class MailArchiveGitHelper {
240240
let counter = 0;
241241
const lineHandler = async (line: string): Promise<void> => {
242242
if (line.startsWith("@@ ")) {
243+
// eslint-disable-next-line security/detect-unsafe-regex
243244
const match = line.match(/^@@ -(\d+,)?\d+ \+(\d+,)?(\d+)?/);
244245
if (match) {
245246
if (counter) {

lib/mail-commit-mapping.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class MailCommitMapping {
4242
refs.push(`+refs/heads/*:refs/remotes/${this.config.repo.maintainerBranch}/*`);
4343
}
4444
if (refs.length) {
45+
console.log(`Updating mail-to-commit/refs: ${refs.join(", ")}`);
4546
await git(["fetch", `https://github.com/${this.config.repo.owner}/${this.config.repo.name}`, ...refs], {
4647
workDir: this.workDir,
4748
});

lib/patch-series.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable security/detect-unsafe-regex */
12
import addressparser from "nodemailer/lib/addressparser/index.js";
23
import mimeFuncs from "nodemailer/lib/mime-funcs/index.js";
34
import { commitExists, git, gitConfig, gitShortHash, revListCount, revParse } from "./git.js";

lib/project-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export async function loadConfig(file: string): Promise<IConfig> {
8080
const { default: newConfig } = (await import(file)) as importedConfig;
8181
loadedConfig = newConfig;
8282
} else {
83+
// eslint-disable-next-line security/detect-non-literal-fs-filename
8384
const fileText = fs.readFileSync(file, { encoding: "utf-8" });
8485
loadedConfig = JSON.parse(fileText) as IConfig;
8586
}

lib/send-mail.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export function parseMBoxMessageIDAndReferences(parsed: IParsedMBox): { messageI
125125
* using regular expressions due to its recursive nature) but seems to be
126126
* good enough for the Git mailing list.
127127
*/
128+
// eslint-disable-next-line security/detect-unsafe-regex
128129
const msgIdRegex = /^\s*<([^>]+)>(\s*|,)(\([^")]*("[^"]*")?\)\s*|\([^)]*\)$)?(<.*)?$/;
129130
for (const header of parsed.headers ?? []) {
130131
if (header.key.match(/In-Reply-To|References/i)) {

lib/sous-chef.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class SousChef {
1818

1919
const branches = sections[i + 1].split(/\n\* ([a-z][^]+?)\n\n/m);
2020
for (let j = 1; j < branches.length; j += 2) {
21+
// eslint-disable-next-line security/detect-unsafe-regex
2122
const match = branches[j].match(/([^ ]+).*\n *(\(merged to [^)]+\))?/m);
2223
if (!match) {
2324
continue;

tests/git-notes.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ test("push()", async () => {
120120
interface O {
121121
hello: string;
122122
bye?: string;
123-
};
123+
}
124124
const o: O = { hello: "world" };
125125
await notes.set("", o);
126126
await notes.push(remoteRepo.workDir);

0 commit comments

Comments
 (0)