decode url on lbrytv server
This commit is contained in:
parent
db5647a7f1
commit
462f1542e7
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,12 @@ async function redirectMiddleware(ctx, next) {
|
|||
const requestHost = ctx.host;
|
||||
const path = ctx.path;
|
||||
const url = ctx.url;
|
||||
const decodedUrl = decodeURIComponent(url);
|
||||
|
||||
if (decodedUrl !== url) {
|
||||
ctx.redirect(decodedUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (path.endsWith('/') && path.length > 1) {
|
||||
ctx.redirect(url.replace(/\/$/, ''));
|
||||
|
|
Loading…
Add table
Reference in a new issue