MCPcopy Create free account
hub / github.com/WJX20/claude-code / asImageFilePath

Function asImageFilePath

src/utils/imagePaste.ts:339–348  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

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

Callers 1

tryReadImageFromPathFunction · 0.85

Calls 2

removeOuterQuotesFunction · 0.85
stripBackslashEscapesFunction · 0.85

Tested by

no test coverage detected