Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add urlfy utils to prefix http:// if protocol is missing from string

Tianzhou Chen3a117e82b9f1
diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts
index d3cc7425e4..fb3fe503ef 100644
--- a/frontend/src/utils/util.ts
+++ b/frontend/src/utils/util.ts
@@ -10,3 +10,11 @@ export function humanize(ts: number) {
}
return time.format("MMM D YYYY");
}
+
+export function urlfy(str: string) {
+ let result = str.trim();
+ if (result.search(/^http[s]?\:\/\//) == -1) {
+ result = "http://" + result;
+ }
+ return result;
+}