diff --git a/services/mam-api/src/routes/assets.js b/services/mam-api/src/routes/assets.js index a8c6cfd..7133758 100644 --- a/services/mam-api/src/routes/assets.js +++ b/services/mam-api/src/routes/assets.js @@ -483,7 +483,7 @@ router.get('/:id/video', async (req, res, next) => { } catch (err) { next(err); } }); -// GET /:id/thumbnail - Signed URL for thumbnail image +// GET /:id/thumbnail - Signed URL (JSON) or 302 redirect (?redirect=1) for thumbnail router.get('/:id/thumbnail', async (req, res, next) => { try { const { id } = req.params; @@ -503,6 +503,9 @@ router.get('/:id/thumbnail', async (req, res, next) => { } const url = await getSignedUrlForObject(thumbnail_s3_key); + + // ?redirect=1 lets work directly in the browser + if (req.query.redirect === '1') return res.redirect(302, url); res.json({ url }); } catch (err) { next(err);