Fix M10: consolidate .url Internet Shortcut parsing into shared utility
Both DownloadBar (renderer, drag-drop) and deeplink.ts (main, argv) had their own regex to extract URL= from a Windows Internet Shortcut file -- with subtly different patterns (/^\s*URL\s*=\s*(\S+)/ vs /^URL=(.+)$/). Added parseUrlShortcutContent() to @shared/ipc. Both callers now delegate to it and apply their own http/https guard (looksLikeUrl in renderer, asHttpUrl in main). The local parseUrlFile wrapper in DownloadBar is kept as the validation compositing point; it's now a one-liner. typecheck + 242 tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -771,6 +771,16 @@ export interface TerminalRunResult {
|
||||
error?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the `URL=` value from a Windows Internet Shortcut (.url) file's content.
|
||||
* Returns the raw URL string (untrimmed), or null if not found.
|
||||
* Callers validate the result with their own http/https check.
|
||||
*/
|
||||
export function parseUrlShortcutContent(text: string): string | null {
|
||||
const m = /^\s*URL\s*=\s*(\S+)/im.exec(text)
|
||||
return m?.[1]?.trim() ?? null
|
||||
}
|
||||
|
||||
/** Overall queue state for the Windows taskbar progress bar (Phase O). */
|
||||
export interface TaskbarProgress {
|
||||
/** 0..1 overall fraction; ignored when mode is 'none' */
|
||||
|
||||
Reference in New Issue
Block a user