fix(host): create folders with the entered name untrimmed

Same contract as the path editor: trim only rejects an all-whitespace
draft, and the Host receives the original spelling — the backend accepts
any non-blank single segment verbatim, so trimming here would create and
select a different sibling.
This commit is contained in:
creatixchu
2026-07-29 05:59:51 +08:00
parent 723bb9057c
commit 463893947b
2 changed files with 16 additions and 2 deletions

View File

@@ -211,8 +211,11 @@ export function DirectoryBrowser({ open, listDirectory, createDirectory, onOpen,
const confirmCreate = (): void => {
/* v8 ignore next -- reentry fence: the nested dialog only renders with a target and disables while creating. */
if (targetPath === null || folderDraft === null || creatingFolder) return
const name = folderDraft.trim()
if (name === '') return
// Trim only rejects an all-whitespace draft; the Host gets the original
// spelling — the backend accepts any non-blank single segment verbatim,
// and trimming here would create (and select) a different sibling.
const name = folderDraft
if (name.trim() === '') return
setCreatingFolder(true)
setCreateError(null)
const generation = openGeneration.current