]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: avoid using document.write() 39372/head
authorAvan Thakkar <athakkar@localhost.localdomain>
Tue, 9 Feb 2021 08:01:59 +0000 (13:31 +0530)
committerAvan Thakkar <athakkar@localhost.localdomain>
Mon, 15 Feb 2021 11:08:37 +0000 (16:38 +0530)
Fixes: https://tracker.ceph.com/issues/49220
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
src/pybind/mgr/dashboard/frontend/src/index.html

index 2f59a0175ac730999db86feedd7beb744c947442..cbe447bbb5455007a484521c3b8d4a19fb8d9ab9 100644 (file)
@@ -1,3 +1,4 @@
+import { APP_BASE_HREF } from '@angular/common';
 import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
 import { ErrorHandler, NgModule } from '@angular/core';
 import { BrowserModule } from '@angular/platform-browser';
@@ -39,6 +40,10 @@ import { SharedModule } from './shared/shared.module';
       provide: HTTP_INTERCEPTORS,
       useClass: ApiInterceptorService,
       multi: true
+    },
+    {
+      provide: APP_BASE_HREF,
+      useValue: window['base-href']
     }
   ],
   bootstrap: [AppComponent]
index bfd6d3ecd83731e1dd316c07d008740c1ca125f9..523fce3fc2be31abe1cef6c7b436bb632cb48b23 100644 (file)
@@ -3,9 +3,10 @@
 <head>
   <meta charset="utf-8">
   <title>Ceph</title>
+  <base href="/">
 
   <script>
-    document.write('<base href="' + document.location+ '" />');
+    window['base-href'] = window.location.pathname;
   </script>
 
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">