fix: handle absolute relative paths
This commit is contained in:
parent
eb6c2d94cc
commit
c7f3ffa2c1
|
@ -33,7 +33,7 @@ export default class URLRewriteFilter implements ContentFilter {
|
||||||
urlValue.startsWith("http") ||
|
urlValue.startsWith("http") ||
|
||||||
(urlValue.startsWith("//") && isICANN(urlValue));
|
(urlValue.startsWith("//") && isICANN(urlValue));
|
||||||
if (!isExternal || !isICANN(urlValue)) {
|
if (!isExternal || !isICANN(urlValue)) {
|
||||||
if (!isExternal) {
|
if (!isExternal && !urlValue.startsWith("/")) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
urlValue = path.join(rUrl.pathname, urlValue);
|
urlValue = path.join(rUrl.pathname, urlValue);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export default class URLRewriteFilter implements ContentFilter {
|
||||||
url.startsWith("http") ||
|
url.startsWith("http") ||
|
||||||
(url.startsWith("//") && isICANN(url));
|
(url.startsWith("//") && isICANN(url));
|
||||||
if (!isExternal || !isICANN(url)) {
|
if (!isExternal || !isICANN(url)) {
|
||||||
if (!isExternal) {
|
if (!isExternal && !url.startsWith("/")) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
url = path.join(rUrl.pathname, url);
|
url = path.join(rUrl.pathname, url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue