Change summary
ui/src/utils/linkify.test.ts | 9 +++++++++
ui/src/utils/linkify.tsx | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
Detailed changes
@@ -233,6 +233,15 @@ const testCases: TestCase[] = [
{ type: "text", content: "> for more" },
],
},
+ {
+ name: "URL in markdown bold - should not include asterisks",
+ input: "Download here: **https://example.com/file.vsix**",
+ expected: [
+ { type: "text", content: "Download here: **" },
+ { type: "link", content: "https://example.com/file.vsix", href: "https://example.com/file.vsix" },
+ { type: "text", content: "**" },
+ ],
+ },
];
function deepEqual(a: unknown, b: unknown): boolean {
@@ -3,7 +3,7 @@ import React from "react";
// Regex for matching URLs. Only matches http:// and https:// URLs.
// Avoids matching trailing punctuation that's likely not part of the URL.
// eslint-disable-next-line no-useless-escape
-const URL_REGEX = /https?:\/\/[^\s<>"'`\]\)]+[^\s<>"'`\]\).,:;!?]/g;
+const URL_REGEX = /https?:\/\/[^\s<>"'`\]\)*]+[^\s<>"'`\]\).,:;!?*]/g;
export interface LinkifyResult {
type: "text" | "link";