We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ccae204 commit 70f284dCopy full SHA for 70f284d
src/shell/hooks/use-domain.ts
@@ -12,7 +12,14 @@ export const useDomain: UseDomain = () => {
12
const { domains }: { domains: Domain[] } = state.instance;
13
14
// Let WebEngine figure out https & www settings
15
- const format = (domain: string) => `http://${domain}`;
+ const format = (domain: string): string => {
16
+ try {
17
+ const url = new URL(domain.includes("://") ? domain : `http://${domain}`);
18
+ return `http://${url.hostname}`;
19
+ } catch (error) {
20
+ return `http://${domain}`; // fallback to the original input with http:// in case of error
21
+ }
22
+ };
23
24
if (Array.isArray(domains) && domains.length) {
25
/**
0 commit comments