We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0e5af66 commit 0baef5eCopy full SHA for 0baef5e
packages/util/src/url.ts
@@ -24,11 +24,15 @@ export function isCloudWorkstation(url: string): boolean {
24
// In HTTP request builders, it's called with the protocol.
25
// If called with protocol prefix, it's a valid URL, so we extract the hostname
26
// If called without, we assume the string is the hostname.
27
- const host =
28
- url.startsWith('http://') || url.startsWith('https://')
29
- ? new URL(url).hostname
30
- : url;
31
- return host.endsWith('.cloudworkstations.dev');
+ try {
+ const host =
+ url.startsWith('http://') || url.startsWith('https://')
+ ? new URL(url).hostname
+ : url;
32
+ return host.endsWith('.cloudworkstations.dev');
33
+ } catch {
34
+ return false;
35
+ }
36
}
37
38
/**
0 commit comments