fix(MediaManager): resolve base_url handling and improve path resolution logic
This commit is contained in:
parent
754139b14a
commit
39c72386fa
|
|
@ -781,8 +781,14 @@ export default function MediaManager({ initialPath = '/', rootPath, title, confi
|
||||||
|
|
||||||
if (!dev.enabled) dev.enabled = 1;
|
if (!dev.enabled) dev.enabled = 1;
|
||||||
if (folderConfig?.['base_url']) {
|
if (folderConfig?.['base_url']) {
|
||||||
dev.base_url = folderConfig['base_url'] === '.' ? path : folderConfig['base_url'];
|
const resolvedBase = (folderConfig['base_url'] === '.' ? path : folderConfig['base_url']).replace(/\/$/, '');
|
||||||
delete dev.url;
|
if (mountEntry.path.startsWith(resolvedBase + '/') || mountEntry.path === resolvedBase) {
|
||||||
|
dev.base_url = resolvedBase;
|
||||||
|
dev.url = mountEntry.path.slice(resolvedBase.length) || '/';
|
||||||
|
} else {
|
||||||
|
delete dev.base_url;
|
||||||
|
// dev.url already set to mountEntry.path above
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (folderConfig?.['cache'] === '.') dev.cache = path;
|
if (folderConfig?.['cache'] === '.') dev.cache = path;
|
||||||
setConfig(newConfig);
|
setConfig(newConfig);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user