coder / code-server

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

Uploading file when a file is selected in the explorer #4327

Closed heungson closed 2 years ago

heungson commented 3 years ago

OS/Web Information

Steps to Reproduce

  1. Select any file in the explorer
  2. Right click mouse on the empty space of the explorer
  3. Upload a file by selecting 'upload' of context menu in the explorer

Expected

'Upload' in the context menu should not be shown when a file is selected.

Actual

Code-server tries to upload a file in the selected file and and get stuck.

Logs

[2021-10-09 02:07:07.846] [window] [error] Unable to write file 'vscode-remote://localhost:8080/home/mllab/test/NotebookBasics.ipynb/vscode-pylance-2021.8.2_vsixhub.com.vsix' (Error: Unable to create folder 'vscode-remote://localhost:8080/home/mllab/test/NotebookBasics.ipynb' that already exists but is not a directory): Error: Unable to write file 'vscode-remote://localhost:8080/home/mllab/test/NotebookBasics.ipynb/vscode-pylance-2021.8.2_vsixhub.com.vsix' (Error: Unable to create folder 'vscode-remote://localhost:8080/home/mllab/test/NotebookBasics.ipynb' that already exists but is not a directory) at ci.writeFile (http://localhost:8080/static/b37ff28a0a582aee84a8f961755d0cb40a4081db/usr/lib/code-server/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:609:15094)

Screenshot

Screenshot_20211009-023022_Chrome

Notes

This issue can be reproduced in VS Code: No (there is no upload in the context menu when a file is selected.) Looks like code-server recognizes a file as a folder.

jsjoeio commented 3 years ago

Hmm...I followed your repro steps and uploading worked for me. Is there anything I'm missing?

https://user-images.githubusercontent.com/3806031/136598642-950da1be-9c32-4ed8-bb85-7c0b620bc290.mov

heungson commented 3 years ago

@jsjoeio Sorry I figured out the real issue here after I posted this report. So I updated the report. I'll attach a screen shot.

jsjoeio commented 3 years ago

Ahhh...thank you! Yeah, I was able to reproduce that. It gets stuck trying to upload via the context menu for some reason 🤔

image

I do see this error in the browser logs:

  ERR Unable to write file 'vscode-remote://localhost:8080/Users/jp/Dev/coder/code-server/src/node/http.ts/Screen Shot 2021-10-08 at 9.52.40 AM.png' (Error: Unable to create folder 'vscode-remote://localhost:8080/Users/jp/Dev/coder/code-server/src/node/http.ts' that already exists but is not a directory): Error: Unable to write file 'vscode-remote://localhost:8080/Users/jp/Dev/coder/code-server/src/node/http.ts/Screen Shot 2021-10-08 at 9.52.40 AM.png' (Error: Unable to create folder 'vscode-remote://localhost:8080/Users/jp/Dev/coder/code-server/src/node/http.ts' that already exists but is not a directory)
    at ci.writeFile (http://localhost:8080/static/4cd55f94c0a72f05c18cea070e10b969996614d2/usr/local/Cellar/code-server/3.12.0/libexec/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:609:15094)
    at async FileReader.z.onload (http://localhost:8080/static/4cd55f94c0a72f05c18cea070e10b969996614d2/usr/local/Cellar/code-server/3.12.0/libexec/vendor/modules/code-oss-dev/out/vs/workbench/workbench.web.api.js:2635:14032)

Thanks for clarifying! We'll need to investigate.

Possibly related:

heungson commented 3 years ago

@jsjoeio Thanks for the quick response and working for this great project!

jsjoeio commented 3 years ago

@heungson no thank YOU for caring enough to file an issue for this bug - it's only a great project because people like you care about making it better!

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.