From d50e07f053c8bc3370b452e5e58aaefd2bbc5671 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 3 Feb 2021 20:58:51 +1300 Subject: [PATCH] Preserve other parameters in video redirection --- api/redirects.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/redirects.js b/api/redirects.js index add9e07..34aa433 100644 --- a/api/redirects.js +++ b/api/redirects.js @@ -3,8 +3,10 @@ const {redirect} = require("pinski/plugins") module.exports = [ { - route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill}) => { - return redirect(`/watch?v=${fill[0]}`, 301) + route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => { + const target = new URLSearchParams(url.search) + target.set("v", fill[0]) + return redirect(`/watch?${target}`, 301) } } ]