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