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