hlx-url-rewriter
Advanced tools
Comparing version
@@ -89,2 +89,7 @@ const path = require('path'); | ||
function createAbsolutePath(url) { | ||
const {rootPath = '/'} = defaultFunc.options; | ||
return createPath(url, rootPath); | ||
} | ||
function rewrite(uri, base) { | ||
@@ -102,3 +107,8 @@ const {rootPath = '/'} = defaultFunc.options; | ||
} | ||
const result = createRelativePath(playlistUrl, url); | ||
let result; | ||
if (url.protocol === playlistUrl.protocol && url.hostname === playlistUrl.hostname) { | ||
result = createRelativePath(playlistUrl, url); | ||
} else { | ||
result = createAbsolutePath(url); | ||
} | ||
print(`\t>>> "${result}"`); | ||
@@ -105,0 +115,0 @@ return `${result}${url.search}${url.hash}`; |
{ | ||
"name": "hlx-url-rewriter", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "A transform stream to modify URLs contained in HLS playlists", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
9704
2.89%136
7.09%