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

Mapping to invalid path delimiter on Windows #62

Closed
L0g4n opened this issue Sep 26, 2020 · 1 comment
Closed

Mapping to invalid path delimiter on Windows #62

L0g4n opened this issue Sep 26, 2020 · 1 comment

Comments

@L0g4n
Copy link
Contributor

L0g4n commented Sep 26, 2020

I have a link to sass file in my index.html like that

<link rel="stylesheet" href="scss/index.scss">

On Unix platforms this works when running trunk serve from the crate directory.
However, on Windows I get an error:
skipping invalid path: \\?\C:\Users\USERNAME\PATH_TO_WD\frontend\scss/index.scss

It seems that trunk does not properly map the slash to the backslash as a forward slash can be seen in the error message.
It works fine if i replace the slash with a backslash, but that would break unix platforms.

@L0g4n
Copy link
Contributor Author

L0g4n commented Sep 29, 2020

So, I am currently looking through the source code to see if I might be able to fix that myself.
I think the problem is that in AssetFile::new() fs::canonicalize is used which is the async version from async-std. The docs for the sync version of this says: https://doc.rust-lang.org/std/fs/fn.canonicalize.html

On Windows, this converts the path to use extended length path syntax, which allows your program to use longer path names, but means you can only join backslash-delimited paths to it, and it may be incompatible with other applications (if passed to the application on the command-line, or written to a file another application may read).

I guess this means that either this subsequent if clause is false (what does the "://" pattern stand for?)

if !path.to_string_lossy().contains("://") {
    progress.println(format!("{}skipping invalid path: {}", Emoji("︎🚫 ", ""), path.to_string_lossy()));
}

or the asset file join logic that is passed to this function is false. Because a normal slash is at one part joined with the rest of the path which results in a invalid Windows path.

thedodd added a commit that referenced this issue Sep 30, 2020
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

1 participant