coder / code-server

VS Code in the browser
https://coder.com
MIT License
66.47k stars 5.45k forks source link

Code server overwrites a directory with a file of the same name instead of blocking this behavior #6839

Closed muyulong closed 2 weeks ago

muyulong commented 2 weeks ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

1.Open code-server in my browser(Microsoft Edge) 2.Create a directory named test123 in the remote terminal, at this point, a directory named test123 appears in the resource manager 3.Create a file called test123 in local 4.Drag the local test123 file to the resource manager in the code-server code-server will report an error, indicating that it cannot write to a file that is actually a directory Repeat step 4, again and again (Translated by Google)

Expected

code-server should report an error, indicating that it cannot write to a file that is actually a directory f57c9378b80e704d1cedc040852f71f48597734d9ad8e1e1a716c804cce4980cQzpcVXNlcnNcYWRtaW5cQXBwRGF0YVxSb2FtaW5nXERpbmdUYWxrXDYyMjE2NTMwMl92MlxJbWFnZUZpbGVzXDE3MTgzNDQyMzQyMTFfODQwOUExN0QtOUNENC00MjBiLUE1QzUtNTAwMTcyQ0FBMDIwLnBuZw==

Actual

After multiple attempts, the code-server pops up a dialog box asking if you want to replace the file If you click replace, the remote test123 directory will be overwritten with the local test123 file, and the test123 directory will be deleted e10e1b030e3a83c60c6cd3b204fdab0aed237452184e9c4ba7bbde69e543537fQzpcVXNlcnNcYWRtaW5cQXBwRGF0YVxSb2FtaW5nXERpbmdUYWxrXDYyMjE2NTMwMl92MlxJbWFnZUZpbGVzXDE3MTgzNDQxNTUzNTdfMEE4NzBCOTItNEI1OS00ZWYwLTkzNUUtNzM3OUQ4OUJDRUU4LnBuZw==

Logs

No response

Screenshot/Video

/

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

Notes

I use Google Translate, and if you need help, I will do my best to provide it

code-asher commented 2 weeks ago

It looks like this might have been fixed since 4.22.1. I tested with 4.90.1, and in my case it asks if I want to replace the directory on the first attempt, which I think is the intended behavior.

screenshot

A file or folder with the name 'test123' already exists in the destination folder. Do you want to replace it?

This action is irreversible!
muyulong commented 2 weeks ago

Thank you for your reply.