-
Notifications
You must be signed in to change notification settings - Fork 12
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 bug introduced by #308 when converting URLs to local paths on Windows #818
Conversation
When using Path.of() we need to pass a URI on a Windows machine, not the Path. Resolves #809
@al-niessner can you poke at this when you can? This is breaking validate on Windows. |
Are you saying that getURI() is not the solution over getPath() so it still does not work? If so, can we undo these changes. I dislike changes that do not fix anything but add complication (new exception handling for no reason). |
Just read the ticket and error. The problem is not getPath(). It is the URL is malformed somehow according the windoze experts. Also wikipedia Let me see if I can round up a windoze box and test a little bit. |
Nope. We are both wrong it seems. JDK 17? I have eclipse running jdk 17 running a simple test and they both work. You can run the test on your windows to see how it does: Code:
Result:
|
LOL - experts were right. The failure is from the Path.of() not in the URL.getPath(). Gads. Anyway, update the test and we are clearly forming the URL incorrectly when we make on windows. Code:
Result:
So, I can chase this back if you like but other than doing simple tests in wine, I cannot really do much. |
Flipping through browser tabs and noticed test is not right. Give me a moment. Have to start wine again. |
Okay, test is now more pedantic. It is a mess because it is so hard for me to use windoze. The answer is, unfortunately, that we need the URI and the URL needs to be fixed. The test results show that if you need/want the x: to become \x in Path, then you need the right number of flipping slashes in the URL. I expanded the testing but it is still hard to read the output but the hint is bb is right and all others are wrong. Back when we create the URL probably should set the protocol rather than prefix with what seems to work. Code:
Output:
|
@al-niessner just did a quick test of this and it looks like this is a weird thing with the URL vs. URI toStrings?
So I'm not sure what to do here? Do we need to fix the URL? Per this, it sounds like it is a difference in the |
@al-niessner nevermind, I think I see the issue. Once convert to URL, it loses the appropriate path information.
|
@al-niessner I have been testing this like crazy and cannot figure out a workaround using URL objects. I think we will need to completely refactor out URLs to URIs throughout the code. That being said, this code appears to now run successfully on windows. Are you saying this does not/should not work? Or that this is bound to break elsewhere in the code if we don't fix this path issue? |
Merging this PR for now since it does fix something. But per comment above, may not fix everything. |
Hi @jordanpadams when will a version with this fix be released? |
🗒️ Summary
When using Path.of() we need to pass a URI on a Windows machine, not the Path.
Resolves #809
⚙️ Test Data and/or Report
See regression tests to verify this doesn't break other tests.
♻️ Related Issues
Resolves #809