| 880 | * @returns Clean filename without query parameters |
| 881 | */ |
| 882 | export function extractCleanFilename(urlOrPath: string): string { |
| 883 | const withoutQuery = urlOrPath.split('?')[0] |
| 884 | |
| 885 | try { |
| 886 | const url = new URL( |
| 887 | withoutQuery.startsWith('http') ? withoutQuery : `http://localhost${withoutQuery}` |
| 888 | ) |
| 889 | const pathname = url.pathname |
| 890 | const filename = pathname.split('/').pop() || 'unknown' |
| 891 | return decodeURIComponent(filename) |
| 892 | } catch { |
| 893 | const filename = withoutQuery.split('/').pop() || 'unknown' |
| 894 | return decodeURIComponent(filename) |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | * Extract workspaceId from execution file key pattern |