Skip to content

Commit

Permalink
fix: ensure regex character classes aren't used for single char (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
virgofx authored Oct 26, 2024
1 parent 42fabc2 commit 79bd587
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export async function getPullRequestCommits(): Promise<CommitDetails[]> {
export async function addReleasePlanComment(
terraformChangedModules: TerraformChangedModule[],
terraformModuleNamesToRemove: string[],
wikiStatus: { status: WikiStatus; errorMessage?: string | undefined },
wikiStatus: { status: WikiStatus; errorMessage?: string },
): Promise<void> {
console.time('Elapsed time commenting on pull request');
startGroup('Adding pull request release plan comment');
Expand Down
4 changes: 2 additions & 2 deletions src/wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ async function updateWikiSidebar(terraformModules: TerraformModule[]): Promise<v
const heading = headingMatch[1].trim();

// Convert heading into a valid ID string (keep only [a-zA-Z0-9-_]) But we need spaces to go to a '-'
const idString = heading.replace(/[ ]+/g, '-').replace(/[^a-zA-Z0-9-_]/g, '');
const idString = heading.replace(/ +/g, '-').replace(/[^a-zA-Z0-9-_]/g, '');

// Append the entry to changelogEntries
changelogEntries.push(
` <li><a href="${baselink}#${idString}">${heading.replace(/[`]/g, '')}</a></li>`,
` <li><a href="${baselink}#${idString}">${heading.replace(/`/g, '')}</a></li>`,
);
}

Expand Down

0 comments on commit 79bd587

Please sign in to comment.