Skip to content

Commit 35d7297

Browse files
committed
fix favicon when baseURL is set
1 parent e982c89 commit 35d7297

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- make user menu switch shorter
1919
- next param support on login route (also preserve next param between login/signup navigation)
2020

21+
# Fixed
22+
23+
- favicon when using BaseURL
24+
2125

2226
# Improved
2327

adminforth/modules/codeInjector.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,12 @@ class CodeInjector implements ICodeInjector {
495495
let indexHtmlContent = await fs.promises.readFile(indexHtmlPath, 'utf-8');
496496
indexHtmlContent = indexHtmlContent.replace('/* IMPORTANT:ADMINFORTH TITLE */', `${this.adminforth.config.customization?.title || this.adminforth.config.customization?.brandName || 'AdminForth'}`);
497497

498+
// we dont't need to add baseUrl in front of assets here, because it is already added by Vite/Vue
498499
indexHtmlContent = indexHtmlContent.replace(
499500
'/* IMPORTANT:ADMINFORTH FAVICON */',
500-
this.adminforth.config.customization.favicon?.replace('@@/', `${this.adminforth.config.baseUrlSlashed}assets/`)
501+
this.adminforth.config.customization.favicon?.replace('@@/', `/assets/`)
501502
||
502-
`${this.adminforth.config.baseUrlSlashed}assets/favicon.png`
503+
`/assets/favicon.png`
503504
);
504505
await fs.promises.writeFile(indexHtmlPath, indexHtmlContent);
505506

0 commit comments

Comments
 (0)