From 74144f1fc6598809f40077327247ed3b84e1b9ba Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 15 Jul 2025 08:47:59 +0200 Subject: [PATCH] fix: handle both share_link formats in gallery token verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Support both full URL and token-only formats in share_link column - Fix gallery info endpoint to correctly validate share tokens - Prevents "gallery not found" errors for valid share links 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- backend/src/routes/gallery.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/gallery.js b/backend/src/routes/gallery.js index cda8014..be72d97 100644 --- a/backend/src/routes/gallery.js +++ b/backend/src/routes/gallery.js @@ -60,7 +60,11 @@ router.get('/:slug/info', async (req, res) => { // If token provided, verify it matches the share link if (token) { - const expectedToken = event.share_link.split('/').pop(); + let expectedToken = event.share_link; + // Handle both formats: full URL or just token + if (event.share_link && event.share_link.includes('/')) { + expectedToken = event.share_link.split('/').pop(); + } if (token !== expectedToken) { return res.status(404).json({ error: 'Invalid gallery link' }); }