File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
code/frontend/src/components/CitationPanel Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments