Skip to content

Fixed url to file conversion breaking paths with spaces #25448

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

Merged
merged 4 commits into from
Apr 11, 2025

Conversation

dmatej
Copy link
Contributor

@dmatej dmatej commented Apr 10, 2025

This PR fixes part of issues seen when manually testing another branch on Windows using path with spaces.
Fixes also a validation issue when URL with empty path could pass into the classloader.
I have cherrypicked also another commit refactoring test which I needed here to confirm issues we have noticed in sources.

@dmatej dmatej added bug Something isn't working Windows labels Apr 10, 2025
@dmatej dmatej added this to the 7.0.24 milestone Apr 10, 2025
@dmatej dmatej requested review from OndroMih, arjantijms and a team April 10, 2025 16:21
@dmatej dmatej self-assigned this Apr 10, 2025
.map(File::new)
.map(File::getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator));
return urls.map(FileUtils::toFile).map(File::getAbsolutePath).collect(Collectors.joining(File.pathSeparator));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep original line breaks to show that only part of the method changed, not the whole one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is under 120 characters border, so it is not so hard to read. I would agree otherwise.

@dmatej dmatej marked this pull request as draft April 10, 2025 22:34
dmatej added 4 commits April 11, 2025 03:37
- This conversion is used very often and I got tired of all issues with that.

Signed-off-by: David Matějček <[email protected]>
- Added coverage of paths with spaces
- Added coverage of adding an empty file path

Signed-off-by: David Matějček <[email protected]>
- Original code broke when path contained spaces
- Added validation of the path before it was added anywhere.
  - Note that FileUtils.toFile throws IAE when the path is empty too, however
    this code is now probably unreachable because of the validation.

Signed-off-by: David Matějček <[email protected]>
@dmatej dmatej marked this pull request as ready for review April 11, 2025 01:39
@dmatej dmatej changed the title Fixed url to file conversion breaking paths on windows Fixed url to file conversion breaking paths with spaces Apr 11, 2025
@dmatej dmatej requested review from OndroMih and a team April 11, 2025 01:47
@dmatej dmatej merged commit 4beb0fc into eclipse-ee4j:master Apr 11, 2025
4 checks passed
@dmatej dmatej deleted the urltofile branch April 11, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants