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

Possible error with fix_url when path contains a space #11

Closed
kbarros opened this issue Jan 18, 2024 · 5 comments
Closed

Possible error with fix_url when path contains a space #11

kbarros opened this issue Jan 18, 2024 · 5 comments

Comments

@kbarros
Copy link

kbarros commented Jan 18, 2024

On Windows, users are reporting that CrystalInfoFramework won't precompile if their username contains a space. I think the error originates in fix_url converting the space character to %20.

For the user, this runs without error

realpath("C:\\Users\\Chaebin Kim\\.julia\\packages\\CrystalInfoFramework\\sNz0e\\test\\templ_enum.cif")

But this throws ERROR: IOError: [...] no such file or directory (ENOENT)

realpath("C:\\Users\\Chaebin%20Kim\\.julia\\packages\\CrystalInfoFramework\\sNz0e\\test\\templ_enum.cif")

The latter case arises because, I think:

parent = "C:\\Users\\Chaebin Kim\\.julia\\packages\\CrystalInfoFramework\\sNz0e\\test"
s = "templ_enum.cif"
println(CrystalInfoFramework.fix_url(s, parent))
# "C:\Users\Chaebin%20Kim\.julia\packages\CrystalInfoFramework\sNz0e\test\templ_enum.cif"
# Observe that `%20` got inserted!
@jamesrhester
Copy link
Owner

Thanks for the report and tracking down the origin. I have reproduced the error on Linux. The Path constructor from FilePaths is not converting the %20 back to a space when provided with a URI type, and this is likely true for any special character in the file path. Will work on a fix.

@jamesrhester
Copy link
Owner

jamesrhester commented Jan 18, 2024

The patch will be simple, if you want to apply it manually, the line

        Path(u.path[2:end])
    else
        Path(u.path)

should be

        Path(unescapeuri(u.path[2:end]))
    else
        Path(unescapeuri(u.path))

in file src/ddlm_dictionary_ng.jl

I will prepare the patch and put out a bugfix release.

@chaebinkim
Copy link

Hi, I was struggling with this issue.
I tried this solution, and it works for me!
Thank you very much for your assistance.

@jamesrhester
Copy link
Owner

Fixed in v0.6.3

@kbarros
Copy link
Author

kbarros commented Jan 18, 2024

Thank you James, this fixes it!

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

No branches or pull requests

3 participants