(fileUrl: string)
| 554 | * would break self-hosted and multi-domain deployments. |
| 555 | */ |
| 556 | export function isInternalFileUrl(fileUrl: string): boolean { |
| 557 | if (typeof fileUrl !== 'string') { |
| 558 | return false |
| 559 | } |
| 560 | |
| 561 | let path = fileUrl |
| 562 | const scheme = /^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i.exec(path) |
| 563 | if (scheme) { |
| 564 | path = path.slice(scheme[0].length) |
| 565 | } |
| 566 | path = path.split(/[?#]/, 1)[0] |
| 567 | |
| 568 | return path.startsWith('/api/files/serve/') |
| 569 | } |
| 570 | |
| 571 | /** |
| 572 | * Infer storage context from a file key using its prefix. |
no outgoing calls
no test coverage detected