Skip to content

Commit f505e8e

Browse files
committed
Avoid local hostname check
1 parent 34b1a35 commit f505e8e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/components/addUtmParameters.ejs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ _%>
88

99
<script>
1010
for(const anchor of document.querySelectorAll("a")) {
11-
if (anchor.getAttribute("href").startsWith("#")) {
11+
const hrefAttr = anchor.getAttribute("href");
12+
if (!hrefAttr.startsWith("http://") && !hrefAttr.startsWith("https://")) {
1213
continue;
1314
}
1415
try {
1516
const url = new URL(anchor.href);
16-
if (!url.protocol.startsWith("http")) {
17-
continue;
18-
}
19-
if (url.hostname === "127.0.0.1") {
20-
continue;
21-
}
2217
const params = new Map();
2318
if (url.hostname.endsWith("sketchy.com")) {
2419
params.set("utm_medium", "partnership");

0 commit comments

Comments
 (0)