mirror of
https://github.com/ZSeven-W/openpencil.git
synced 2026-06-01 03:14:29 +07:00
Image #42 logs showed every image fetch URL came out wrapped twice: http://localhost:3000/api/local-asset?path=%2Fapi%2Fai%2Fimage-proxy%3Furl%3D... The image-search pipeline correctly returned \`/api/ai/image-proxy?url=...\` thumbUrls (so browser fetches go through the dev server, which can reach openverse via the system proxy). But \`isLocalAssetPath\` only excluded \`data:\`/\`https?:\`/ \`blob:\` from local-asset bridging — anything else, including absolute paths starting with \`/api/\`, was treated as a file-system asset and re-wrapped through \`/api/local-asset?path=\`. That bridge handler then 404s because the encoded path \`/api/ai/image-proxy?...\` isn't a real file. Net effect: every search-found image stayed at the placeholder visual even though the search succeeded. Add a same-origin route carve-out: /^\/(?:api|_)\// Paths under those prefixes are runtime endpoints (Nitro \`/api/*\`, Vite \`/_/*\`), not file system assets, so they pass through the resolver as-is. \`/assets/hero.png\` and similar absolute file-style paths still go through the local-asset bridge. New regression test covers /api/ai/image-proxy, /api/local-asset, and /_/* paths returning false from isLocalAssetPath, and verifies ordinary /assets/... paths still return true. |
||
|---|---|---|
| .. | ||
| public | ||
| server | ||
| src | ||
| CLAUDE.md | ||
| components.json | ||
| dev.ts | ||
| package.json | ||
| tsconfig.json | ||
| vite.config.ts | ||