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.
Description
When the target file does not exist at the given path,
getChildFileFromNamereturns{index: -1, file: undefined}. The destructuredindexis -1, andcurrentFolder.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:
criticalFile:
src/fileUtils.jsExpected Behavior
The code should handle this case properly to avoid unexpected errors or degraded quality.