Skip to content
TypeScript

fix(server): thread titles use linked PR context when the URL is followed by a colon or bold markers (#29656)

Alex Southwell4f58294ca821
diff --git a/apps/server/src/textGeneration/ThreadTitleLinks.test.ts b/apps/server/src/textGeneration/ThreadTitleLinks.test.ts
index ccb4cbfde9f..d7a34a70884 100644
--- a/apps/server/src/textGeneration/ThreadTitleLinks.test.ts
+++ b/apps/server/src/textGeneration/ThreadTitleLinks.test.ts
@@ -20,7 +20,7 @@ it.effect(
const result = yield* resolveThreadTitleLinks({
cwd: "/tmp/project",
message:
- "https://docs.test/guide [https://forge.test/change/1] https://forge.test/change/1#discussion https://forge.test/change/1?view=full `https://forge.test/change/2` https://forge.test/change/2. https://forge.test/change/3",
+ "https://docs.test/guide **https://forge.test/change/1**: [https://forge.test/change/1] https://forge.test/change/1#discussion https://forge.test/change/1?view=full `https://forge.test/change/2` https://forge.test/change/2. https://forge.test/change/3",
}).pipe(
Effect.provide(
layerRegistry({
diff --git a/apps/server/src/textGeneration/ThreadTitleLinks.ts b/apps/server/src/textGeneration/ThreadTitleLinks.ts
index 695e93e1f2d..cb6f0d924d2 100644
--- a/apps/server/src/textGeneration/ThreadTitleLinks.ts
+++ b/apps/server/src/textGeneration/ThreadTitleLinks.ts
@@ -13,7 +13,7 @@ export const resolveThreadTitleLinks = Effect.fn("resolveThreadTitleLinks")(func
const providers = yield* SourceControlProviderRegistry.SourceControlProviderRegistry;
const links = new Map<string, NonNullable<ReturnType<typeof providers.resolveLink>>>();
for (const match of input.message.matchAll(/https:\/\/[^\s<>"')\]`]+/g)) {
- const candidate = match[0].replace(/[.,;!?]+$/, "");
+ const candidate = match[0].replace(/[.,:;!?*]+$/, "");
if (!URL.canParse(candidate)) continue;
const url = new URL(candidate);
url.hash = "";