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 8c53dbc commit 53e5ba5Copy full SHA for 53e5ba5
1 file changed
vis/js/utils/url.ts
@@ -102,11 +102,19 @@ const handleSelectPaper = (action: any) => {
102
103
const handleDeselectPaper = () => removeQueryParams("paper");
104
105
+export const checkIsCurrentHostIsLocalhost = (): boolean => {
106
+ const currentHost: string = window.location.host;
107
+ return currentHost.startsWith("localhost");
108
+};
109
+
110
export const ensureThatURLStartsWithHTTP = (url: string): string => {
111
let formattedURL = url;
112
113
+ const isCurrentHostIsLocalhost = checkIsCurrentHostIsLocalhost();
114
+ const protocolToBeAdded = isCurrentHostIsLocalhost ? "http" : "https";
115
116
if (!/^https?:\/\//i.test(url)) {
- formattedURL = "https:" + url;
117
+ formattedURL = `${protocolToBeAdded}:${url}`;
118
}
119
120
return formattedURL;
0 commit comments