Skip to content

[high, unverified] New File on an existing name silently overwrites it with empty content #507

Open

Description

@Interstellar-code

Unverified: the bug-hunt's skeptic check did not reach a verdict on this finding. Verify it before fixing.

Location: src/screens/files/files-screen.tsx:2052

Severity: high · Confidence: high

When

The user types the name of an existing file into the New File box and clicks Save or presses Enter.

Effect

The existing file is silently emptied and the user sees a normal success result.

Evidence

Prompt submit for mode 'new-file' (lines 2048-2060): const nextPath = promptState.targetPath ? ${promptState.targetPath}/${value} : value then body: JSON.stringify({ action: 'write', path: nextPath, content: '' }). Server src/routes/api/files.ts:479-480 does await fs.mkdir(path.dirname(filePath), { recursive: true }) and await fs.writeFile(filePath, content, 'utf8') with no existence check. The Save button in the unit (line 3034, <Button onClick={() => void handlePromptSubmit()}>Save</Button>) and Enter key (line 3021-3022) trigger this path.

Skeptic note

no usable skeptic answer


Bug-hunt id: bh:1a3351e2 · run: sweep:screens / slice screens · source: ~/.bughunt-data/repos/hermes-switchui/reports/2026-10-27-screens.json (local path on the owner's Mac)

Filed from the 2026-10-27 bug-hunt sweep (unverified, not triaged).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions