fix(host): keep path entry available when the home listing fails

With no listed level (an unreadable or missing home directory), the
path-edit zone previously disabled forever, stranding the operator on the
alert with only Cancel; it now opens with an empty draft so an absolute
path remains the way forward. Covered by a recovery test.
This commit is contained in:
creatixchu
2026-07-29 00:04:06 +08:00
parent af049cceaf
commit d2b16380d1
2 changed files with 20 additions and 3 deletions

View File

@@ -282,9 +282,11 @@ export function DirectoryBrowser({ open, listDirectory, createDirectory, onOpen,
type="button"
className={css.crumbEditZone}
aria-label={t('browser.editPath')}
disabled={parent === null || parentInert}
/* v8 ignore next -- narrowing guard: the zone disables while the level is null. */
onClick={() => { if (parent !== null) setPathDraft(selected?.path ?? parent.path) }}
// Stays available with no listed level: when the home
// listing itself fails, typing an absolute path is the one
// remaining way forward.
disabled={parentInert}
onClick={() => { setPathDraft(selected?.path ?? parent?.path ?? '') }}
/>
</>
)