Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI update: Fix relative manager URL (#1712)

Wouter Bornc4ed8f295c9d
diff --git a/ui/component/core/src/index.ts b/ui/component/core/src/index.ts
index 9b5f46397..aa47ef9f0 100644
--- a/ui/component/core/src/index.ts
+++ b/ui/component/core/src/index.ts
@@ -92,7 +92,7 @@ export function normaliseConfig(config: ManagerConfig): ManagerConfig {
if (!normalisedConfig.managerUrl || normalisedConfig.managerUrl === "") {
// Assume manager is running on same host as this code
normalisedConfig.managerUrl = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "")
- + window.location.pathname.replace(/\/manager\/\S*/g, "");
+ + window.location.pathname.replace(/\/[^/]+\/?$/, '');
} else {
// Normalise by stripping any trailing slashes
normalisedConfig.managerUrl = normalisedConfig.managerUrl.replace(/\/+$/, "");