openvibers/openvibe.media Commits

Redirect /p/:slug/raw to /screenshot for image pastes (stale hero-moment URLs)

OP OpenVibers committed 18 Aug 2026 · 052ea86c34 · 1 file, +6 −0

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xw6Sf5zzSALw8m93XNu5JE

Changes

ddiff --git a/server/public/routes.js b/server/public/routes.js
iindex f20359d..3b6c86a 100644
---- a/server/public/routes.js
++++ b/server/public/routes.js
@@@ -483,6 +483,12 @@ router.get('/p/:slug', optionalIdentity, (req, res) => {
router.get('/p/:slug/raw', (req, res) => {
try {
const paste = db.getPasteBySlug(String(req.params.slug));
++ // Image pastes have no raw text — bounce to the screenshot (stale
++ // consumers stored /raw URLs for hero-moment images).
++ if (paste && paste.type === 'screenshot') {
++ res.set('Cache-Control', 'public, max-age=3600');
++ return res.redirect(302, `/p/${encodeURIComponent(paste.slug)}/screenshot`);
++ }
if (!paste || paste.type !== 'paste') return res.status(404).send('Not found');
if (paste.visibility === 'private') return res.status(404).send('Not found');