Skip to content

Commit

Permalink
fix: sanitize pds versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-ext committed Nov 19, 2024
1 parent dcfa297 commit 03b0d6d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/generate-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Instances that have not been active for more than 7 days gets dropped off from t
const { errorAt, inviteCodeRequired, version } = info;

const on = errorAt === undefined ? '✅' : '❌';
const v = version || (version === null ? 'N/A' : '???');
const v = version ? heavilySanitize(version) : version === null ? 'N/A' : '???';
const invites = inviteCodeRequired === false ? 'Yes' : 'No';

if (isBlueskyHost(host)) {
Expand All @@ -111,7 +111,7 @@ Instances that have not been active for more than 7 days gets dropped off from t
const { errorAt, version } = info;

const on = errorAt === undefined ? '✅' : '❌';
const v = version || (version === null ? 'N/A' : '???');
const v = version ? heavilySanitize(version) : version === null ? 'N/A' : '???';

if (isBlueskyHost(host)) {
labelerBskyTable += `| ${on} ${host} | ${v} |\n`;
Expand Down Expand Up @@ -221,4 +221,8 @@ Instances that have not been active for more than 7 days gets dropped off from t
function isBlueskyHost(host: string): boolean {
return /(?:^|\.)(?:bsky\.network|bsky\.app|bsky\.dev|bsky\.social)$/.test(host);
}

function heavilySanitize(str: string): string {
return str.replace(/([\\`*_{}\[\]()#+!])/g, '\\$1');
}
}

0 comments on commit 03b0d6d

Please sign in to comment.