From 594b6d61c3742a3fcf5ef02dd80c9ab4b562cd0b Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Tue, 20 Sep 2022 16:21:01 +0200 Subject: [PATCH] 94485: Use relative path for theme CSS This bug was originally fixed in #1642 but reintroduced in #1805 --- src/app/shared/theme-support/theme.service.spec.ts | 2 +- src/app/shared/theme-support/theme.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/shared/theme-support/theme.service.spec.ts b/src/app/shared/theme-support/theme.service.spec.ts index 43b5964b8c..f56fb86cbc 100644 --- a/src/app/shared/theme-support/theme.service.spec.ts +++ b/src/app/shared/theme-support/theme.service.spec.ts @@ -413,7 +413,7 @@ describe('ThemeService', () => { link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); link.setAttribute('class', 'theme-css'); - link.setAttribute('href', '/custom-theme.css'); + link.setAttribute('href', 'custom-theme.css'); expect(headSpy.appendChild).toHaveBeenCalledWith(link); }); diff --git a/src/app/shared/theme-support/theme.service.ts b/src/app/shared/theme-support/theme.service.ts index c0b04cd6b3..6d2939a5f8 100644 --- a/src/app/shared/theme-support/theme.service.ts +++ b/src/app/shared/theme-support/theme.service.ts @@ -182,7 +182,7 @@ export class ThemeService { link.setAttribute('rel', 'stylesheet'); link.setAttribute('type', 'text/css'); link.setAttribute('class', 'theme-css'); - link.setAttribute('href', `/${encodeURIComponent(themeName)}-theme.css`); + link.setAttribute('href', `${encodeURIComponent(themeName)}-theme.css`); // wait for the new css to download before removing the old one to prevent a // flash of unstyled content link.onload = () => {