Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use /media/paintings/<code> directly for 3-letter codes

prefetchPicture did a /api/painting-code lookup first, then passed the
returned (fully-qualified) slug into .painting().by(). .by()'s URL
builder assumed the slug was a bare timestamp, so it produced
/media/paintings/auth0|.../painting/TS.png — which lith 404s on since
it tries to treat the long path as a short code.

The /media/paintings/<code>.png endpoint already resolves the slug and
user server-side, so skip the client-side lookup and hit it directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+11 -22
+11 -22
system/public/aesthetic.computer/lib/disk.mjs
··· 6118 6118 console.warn(`⚠️ Painting timestamp without handle: ${actualCode}`); 6119 6119 delete paintings[code]; 6120 6120 } else if (actualCode.length === 3 && actualCode.match(/^[a-zA-Z0-9]{3}$/)) { 6121 - // 3-letter code format (e.g., "mzc", "qkm") 6122 - // Need to look up the handle/slug first via the painting-code API 6123 - try { 6124 - const response = await fetch(`/api/painting-code?code=${actualCode}`); 6125 - if (!response.ok) { 6126 - throw new Error(`Painting code not found: ${actualCode}`); 6127 - } 6128 - const data = await response.json(); 6129 - 6130 - // Now load using handle/slug 6131 - const handle = data.handle || 'anon'; 6132 - $commonApi.get 6133 - .painting(data.slug) 6134 - .by(handle) 6135 - .then(({ img }) => cacheAndStore(img)) 6136 - .catch(() => { 6137 - delete paintings[code]; 6138 - }); 6139 - } catch (err) { 6140 - console.error(`Failed to lookup painting code ${actualCode}:`, err); 6141 - delete paintings[code]; 6142 - } 6121 + // 3-letter code — the `/media/paintings/<code>.png` endpoint resolves 6122 + // the slug + user server-side, so we don't need a separate painting-code 6123 + // lookup (which returned a fully-qualified slug and broke `.by()` URL 6124 + // construction). 6125 + $commonApi.get 6126 + .painting(actualCode) 6127 + .by() 6128 + .then(({ img }) => cacheAndStore(img)) 6129 + .catch(() => { 6130 + delete paintings[code]; 6131 + }); 6143 6132 } else { 6144 6133 // Unknown format - try as direct code anyway 6145 6134 $commonApi.get