-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix broken path in chat example in windows #4648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the interest in contributing!
I don't think it is the best approach right now since "./index.html" is already declared at const u = ...
also u.pathname should return the same "/index.html".
It's important to note that in Ubuntu 18.04 it's running without problems
Thank you very much and I hope to be able to collaborate on the project in the long run Unfortunately, this is not the case in Windows, and u.pathname is not same to "./index.html" , it will be : |
new URL href & pathname are standardized [here] and cannot be changed separately in node or deno , in node , a function in url library [here] is provided for convert this kind of file path in windows , which solves this problem . anyway , currently this file has problems on Windows, and the shortest way to solve is to use ./index.html alternatives : function urlToFilePath(url: URL): string {
// Since `new URL('file:///C:/a').pathname` is `/C:/a`, remove leading slash.
return url.pathname.slice(url.protocol == "file:" && isWindows ? 1 : 0);
} or another approach in node module [ here ]: and the last solution is to change fs readFile functions behavior to work with |
I would go with node's approach. Simple because it's already done there and we know it works. |
…into completing_node_fs
Completing node fs
fix this : #4647