Skip to content

fix(fileUtils.js): removefileatpath silently corrupts file tree when file not found (splice with index -1) #605

Description

Description

When the target file does not exist at the given path, getChildFileFromName returns {index: -1, file: undefined}. The destructured index is -1, and currentFolder.splice(-1, 1) silently removes the last item in the array instead of the intended file. This is silent data corruption — the user deletes a nonexistent path and loses an unrelated file.

Severity: critical
File: src/fileUtils.js

Expected Behavior

The code should handle this case properly to avoid unexpected errors or degraded quality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions