diff --git a/package.json b/package.json index d8f21330..b1bd0204 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Calvin Montgomery", "name": "CyTube", "description": "Online media synchronizer and chat", - "version": "3.67.0", + "version": "3.67.1", "repository": { "url": "http://github.com/calzoneman/sync" }, diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 31fe9943..43963ead 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -84,7 +84,9 @@ function initFFLog() { } function fixRedirectIfNeeded(urldata, redirect) { - if (!/^https:/.test(redirect)) { + let parsedRedirect = urlparse.parse(redirect); + if (parsedRedirect.host === null) { + // Relative path, munge it to absolute redirect = urldata.protocol + "//" + urldata.host + redirect; } @@ -135,6 +137,13 @@ function testUrl(url, cb, params = { redirCount: 0, cookie: '' }) { const { redirCount, cookie } = params; var data = urlparse.parse(url); if (!/https:/.test(data.protocol)) { + if (redirCount > 0) { + // If the original URL redirected, the user is probably not aware + // that the link they entered (which was HTTPS) is redirecting to a + // non-HTTPS endpoint + return cb(`Unexpected redirect to a non-HTTPS link: ${url}`); + } + return cb("Only links starting with 'https://' are supported " + "for raw audio/video support"); }