Repository navigation
Reject renaming a file over a directory - #23
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
There was a problem hiding this comment.
The PR fixes a bug in MemoryBackend.rename where renaming a file onto an existing directory would succeed and corrupt the filesystem state by leaving the same path in both the file and directory maps. The fix adds a check to reject the rename when the target path is already a directory. A regression test verifies the file and directory remain intact after a failed rename, and that renaming a file over another file still works.
review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve
Renaming a file over a directory in the memory filesystem succeeds and leaves the same path in both the file and directory maps. Reject that rename before changing either entry.
A regression test checks that the file and directory stay intact and that replacing another file still works.
Test:
node --test test/fs.test.ts.