Skip to content

Commit 1a7d601

Browse files
committed
fix JS failing unit tests
Signed-off-by: Najam Ul Saqib <najamulsaqib@tutamail.com>
1 parent 66efc30 commit 1a7d601

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/zapHomeFiles/hud/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ const utils = (function () {
121121
hostname = hostname.split('?')[0];
122122
hostname = hostname.split('#')[0];
123123

124+
// Remove port if present
125+
hostname = hostname.split(':')[0];
126+
127+
// Split the hostname into parts
128+
const parts = hostname.split('.');
129+
130+
// If the hostname has more than two parts, return the last two parts as the domain
131+
if (parts.length > 2) {
132+
return parts.slice(-2).join('.');
133+
}
134+
124135
return hostname;
125136
}
126137

0 commit comments

Comments
 (0)