@jacebenson/jsn 4.3.5-dev.7 → 4.3.5-dev.8
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.
- package/package.json +1 -1
- package/src/config.js +8 -2
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -29,11 +29,17 @@ export function cacheDir() {
|
|
|
29
29
|
export function normalizeInstanceURL(url) {
|
|
30
30
|
if (!url) return '';
|
|
31
31
|
url = url.trim();
|
|
32
|
-
url = url.replace(/\/$/, '');
|
|
33
32
|
if (!/^https?:\/\//i.test(url)) {
|
|
34
33
|
url = 'https://' + url;
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
try {
|
|
36
|
+
// Profiles store the instance origin, never a page, API route, query, or
|
|
37
|
+
// fragment pasted from the browser.
|
|
38
|
+
return new URL(url).origin;
|
|
39
|
+
} catch {
|
|
40
|
+
// Preserve the old permissive behavior for non-standard local endpoints.
|
|
41
|
+
return url.replace(/\/$/, '');
|
|
42
|
+
}
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
function loadFromFile(cfg, filePath, source) {
|