Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot download a files containing # #80

Closed
wernight opened this issue Oct 22, 2016 · 7 comments
Closed

Cannot download a files containing # #80

wernight opened this issue Oct 22, 2016 · 7 comments

Comments

@wernight
Copy link

  • Version (cloudcmd -v): v5.7.0 (Dockerized version)
  • OS: Windows
  • Browser name/version: Chrome

If a file contains # in its name, drag & drop of that file to the local file explorer will fail: Browser says cannot find the file.

My guess is that # is not escaped which leads to probably other filenames other that are not working.

@coderaiser
Copy link
Owner

It is worth noting that the part after the #, also known as fragment identifier, is never sent to the server with the request.

Identifying resources on the Web.

The only way out from this situation is avoid such names, unfortunately. Have no idea how to fix this. Do you have some? Can you tell my why you need such file names?

@coderaiser
Copy link
Owner

Looks like it related to #17.

@coderaiser
Copy link
Owner

Fixed with 47b12bb.

@coderaiser
Copy link
Owner

Landed in v5.7.2.

@wernight
Copy link
Author

Look like a good fix, but should it also escape other characters like ?, %, etc? Sounds like it should URL-escape the string.

@machuu
Copy link
Contributor

machuu commented Apr 16, 2018

Downloading a file with a hash is breaking in the latest Docker image.

I think .replace(/#/g, '%23') needs to happen when setting encodedPath in client/modules/menu.js. In fact, path doesn't need to be encoded at all.

Here's what I'm seeing:

  • filename is "filename_with_#"
  • .replace(/#/g, '%23') converts # -> %23
    • path="filename_with_%23"
  • encodeURI(path) converts % -> %25
    • encodedPath="filename_with_%2523"

Using the Chrome Dev Tools, I can successfully download the test file by:

  1. Pause after encodedPath is set on line menu.js:321
  2. Edit encodedPath, filename_with_%2523 -> filename_with_%23
  3. Edit path, filename_with_%23 -> filename_with_#
  4. Continue Script Execution
  5. File filename_with_# successfully downloads

I've sent a Pull Request with a fix that works after editing main.js in my docker container.

@coderaiser
Copy link
Owner

Thank you :). Landed in v9.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants