Deleting a file retains content

Problem description:
When you delete a file and then create a new file with the same name, the contents of the now-deleted file appear in the new file.

Expected behavior:
When you delete a file and create a new one with the same name, the new one should be empty.

Actual behavior:
When you delete a file and create a new one with the same name, the new one is not empty. Instead, it has the content from the original file in it.

Steps to reproduce:

  1. Create a new file
  2. Type something into the file
  3. Delete the file
  4. Create a new file with the same name as the original file
  5. Open it

Browser/OS/Device:
Browser.

I can reproduce this on Windows 11, FF developer edition 108.0b9.

I would argue that this is expected behaviour as file history should be able to retrieve accidentally deleted files. One alternative solution would be to delete the contents of the file, rather than delete the file and create a new one with exactly the same name.

3 Likes

Are the deleted files preserved when the Replit is forked? If so, it could allow others to access information the creator thought was deleted.

Hi @WWBJSFWGWYBAUPA the answer to your question is no. I’ve just tried forking a number of randomly selected Repls from community and I just see the most up to date version.

1 Like