From bacd459682ae8ea946cfc386d817e6aa16a6e253 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Thu, 18 Nov 2021 08:52:38 +0100 Subject: [PATCH] fix path with trailing slash --- src/components/Player.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index 04700488..ce04a0d0 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -187,7 +187,11 @@ export default { if (this.getPreferenceBoolean("proxyLBRY", false)) { const url = new URL(uri); const proxyURL = new URL(this.video.proxyUrl); - const proxyPath = proxyURL.pathname === "/" ? "" : proxyURL.pathname; + let proxyPath = proxyURL.pathname; + if (proxyPath.lastIndexOf("/") === proxyPath.length - 1) { + proxyPath = proxyPath.substring(0, proxyPath.length - 1); + } + url.searchParams.set("host", url.host); url.protocol = proxyURL.protocol; url.host = proxyURL.host; @@ -212,7 +216,10 @@ export default { const localPlayer = new this.shaka.Player(videoEl); const proxyURL = new URL(component.video.proxyUrl); - const proxyPath = proxyURL.pathname === "/" ? "" : proxyURL.pathname; + let proxyPath = proxyURL.pathname; + if (proxyPath.lastIndexOf("/") === proxyPath.length - 1) { + proxyPath = proxyPath.substring(0, proxyPath.length - 1); + } localPlayer.getNetworkingEngine().registerRequestFilter((_type, request) => { const uri = request.uris[0];