@fern-api/ui-core-utils 0.139.5-1605edfbc → 0.139.5-2c30cfa75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,6 +58,10 @@ describe("sanitizeUrl", () => {
|
|
|
58
58
|
expect(sanitizeUrl("https://user:pass@example.com")).toBe("https://user:pass@example.com/");
|
|
59
59
|
expect(sanitizeUrl("user:pass@example.com")).toBe("https://user:pass@example.com/");
|
|
60
60
|
});
|
|
61
|
+
it("handles websocket protocol", () => {
|
|
62
|
+
expect(sanitizeUrl("wss://streaming.assemblyai.com")).toBe("wss://streaming.assemblyai.com/");
|
|
63
|
+
expect(sanitizeUrl("ws://streaming.assemblyai.com")).toBe("ws://streaming.assemblyai.com/");
|
|
64
|
+
});
|
|
61
65
|
it("handles IP addresses", () => {
|
|
62
66
|
expect(sanitizeUrl("https://192.168.1.1")).toBe("https://192.168.1.1/");
|
|
63
67
|
expect(sanitizeUrl("192.168.1.1")).toBe("https://192.168.1.1/");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAqCvE"}
|
package/dist/sanitizeUrl.js
CHANGED
|
@@ -17,7 +17,10 @@ export function sanitizeUrl(url) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
// handle URLs without protocol
|
|
20
|
-
if (!url.startsWith("http://") &&
|
|
20
|
+
if (!url.startsWith("http://") &&
|
|
21
|
+
!url.startsWith("https://") &&
|
|
22
|
+
!url.startsWith("wss://") &&
|
|
23
|
+
!url.startsWith("ws://")) {
|
|
21
24
|
try {
|
|
22
25
|
const parsedUrl = new URL(`https://${url}`);
|
|
23
26
|
return parsedUrl.toString();
|