mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-31 01:24:37 +02:00
maintain host after resolving link
This commit is contained in:
parent
19bed0a929
commit
b32ec187c7
@ -41,12 +41,12 @@ router.beforeEach(async (to, from) => {
|
||||
if (to.fullPath === lastValidRoutePath) {
|
||||
return true; // ignore from updating window.location.hash
|
||||
}
|
||||
const host = to.params.host?.replace(/^\/|:$/g, '') ?? undefined;
|
||||
const host = to.params.host.replace(/^\/|:$/g, '') || undefined;
|
||||
if (to.name === 'browse') {
|
||||
try {
|
||||
let realPath = (await useSpawn(['realpath', '--canonicalize-existing', to.params.path], { superuser: 'try', host }).promise()).stdout.trim();
|
||||
if (to.params.path !== realPath)
|
||||
return `/browse${realPath}`;
|
||||
return `/browse${to.params.host}${realPath}`;
|
||||
try {
|
||||
await useSpawn(['test', '-r', to.params.path, '-a', '-x', to.params.path], { superuser: 'try', host }).promise();
|
||||
} catch {
|
||||
|
Loading…
x
Reference in New Issue
Block a user