(text: string)
| 342 | * @returns Cleaned text with quotes removed, whitespace trimmed, and shell escapes removed, or null if not an image path |
| 343 | */ |
| 344 | export function asImageFilePath(text: string): string | null { |
| 345 | const cleaned = removeOuterQuotes(text.trim()) |
| 346 | const unescaped = stripBackslashEscapes(cleaned) |
| 347 | |
| 348 | if (IMAGE_EXTENSION_REGEX.test(unescaped)) { |
| 349 | return unescaped |
| 350 | } |
| 351 | |
| 352 | return null |
| 353 | } |
| 354 | |
| 355 | /** |
| 356 | * Try to find and read an image file, falling back to clipboard search |
no test coverage detected