From 5a4eb7fc33b7e3a79f1243729ff4659fbe721fe8 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Fri, 21 Apr 2023 18:57:18 +0200 Subject: [PATCH] Fix: wrong usage of URL.protocol, again --- server/lib/uri/canonicalize.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/lib/uri/canonicalize.ts b/server/lib/uri/canonicalize.ts index fffe6903..88654279 100644 --- a/server/lib/uri/canonicalize.ts +++ b/server/lib/uri/canonicalize.ts @@ -34,8 +34,8 @@ export function canonicalizePluginUri ( uri = new url.URL(path, options.peertubeHelpers.config.getWebserverUrl()) } if (canonicalizeOptions?.protocol) { - // Assuming that current protocol is https? or wss?, other cases dont concern us, and will be buggy - const currentProtocolSecure = uri.protocol.endsWith('s:') + // Assuming that current protocol is https?: or wss?:, other cases dont concern us, and will be buggy + const currentProtocolSecure = uri.protocol === 'https:' || uri.protocol === 'wss:' if (canonicalizeOptions.protocol === 'http') { uri.protocol = currentProtocolSecure ? 'https' : 'http' } else if (canonicalizeOptions.protocol === 'ws') {