Skip to content

Commit f2976be

Browse files
fix: citation link issue resolved (#1937)
1 parent f45aae8 commit f2976be

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

code/frontend/src/components/CitationPanel/CitationPanel.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ function rewriteCitationUrl(markdownText: string) {
1717
(match, title, url) => {
1818
try {
1919
const parsed = new URL(url);
20+
const blobStorageHost = 'blob.core.windows.net';
2021

21-
// Take only the last segment of the path
22-
const filename = parsed.pathname.split('/').pop();
23-
return `[${title}](/api/files/${filename})`;
22+
if (parsed.hostname.includes(blobStorageHost)) {
23+
// Extract the filename from the path
24+
const filename = parsed.pathname.split('/').pop();
25+
return `[${title}](/api/files/${filename})`;
26+
} else {
27+
// Return the full external URL
28+
return `[${title}](${parsed.href})`;
29+
}
2430
} catch {
2531
return match; // fallback if URL parsing fails
2632
}

0 commit comments

Comments
 (0)