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) {
17
17
( match , title , url ) => {
18
18
try {
19
19
const parsed = new URL ( url ) ;
20
+ const blobStorageHost = 'blob.core.windows.net' ;
20
21
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
+ }
24
30
} catch {
25
31
return match ; // fallback if URL parsing fails
26
32
}
You can’t perform that action at this time.
0 commit comments