Skip to content

Commit 42b6688

Browse files
committed
should have finally fixed relative url issues
1 parent f6e0ac8 commit 42b6688

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

content.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ function parseUrl(tab) {
1717
tab.url = window.location.protocol + "//" + window.location.hostname + tab.url;
1818
} else if (/.*\/$/.test(window.location.href)) {
1919
// else if starts with any other character then if ends in / append to current level
20-
tab.url = window.location.href + "/" + tab.url;
21-
} else {
22-
// else lose last bit until / and append to current level
20+
tab.url = window.location.href + tab.url;
21+
} else if (/^.*[^/]+\.[^./]+$/.test(window.location.href)) {
22+
// else if ends in a file, lose last bit until / and append to current level
2323
var str = window.location.href.split("/");
2424
str.pop();
2525
tab.url = str.join("/") + "/" + tab.url;
26+
} else {
27+
// else doesn't end in / so append / and relative url
28+
tab.url = window.location.href + "/" + tab.url;
2629
}
2730
}
2831

0 commit comments

Comments
 (0)