(url: string)
| 190 | * contain `#`, spaces, etc. Falls back to the raw segment on malformed escapes. |
| 191 | */ |
| 192 | export function getFilenameFromUrl(url: string): string { |
| 193 | const segment = new URL(url).pathname.split('/').pop() || 'unknown'; |
| 194 | try { |
| 195 | return decodeURIComponent(segment); |
| 196 | } catch { |
| 197 | return segment; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Normalize Git hosting URLs to use raw file endpoints instead of web viewer URLs. |
no outgoing calls
no test coverage detected