Fix handling of "file:" paths to non-existent files on Windows#26575
Merged
jhoeller merged 1 commit intospring-projects:masterfrom Feb 25, 2021
Merged
Fix handling of "file:" paths to non-existent files on Windows#26575jhoeller merged 1 commit intospring-projects:masterfrom
jhoeller merged 1 commit intospring-projects:masterfrom
Conversation
For setAsText, if the text argument is a file: URL for a path that does not exist, Paths.get(text) is called where text is a file: URL, which doesn't work - the result is an InvalidPathException. To fix this issue, also check that the resource isn't a file before calling Paths.get(). That way, resources that are files skip to the other branch.
Contributor
Author
|
I've added some tests to |
jhoeller
added a commit
that referenced
this pull request
Feb 25, 2021
For setAsText, if the text argument is a file: URL for a path that does not exist, Paths.get(text) is called where text is a file: URL, which doesn't work - the result is an InvalidPathException. To fix this issue, also check that the resource isn't a file before calling Paths.get(). That way, resources that are files skip to the other branch. Closes gh-26575
This was referenced Mar 16, 2021
This was referenced Mar 17, 2021
Closed
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this pull request
Mar 26, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, for
setAsText, if the text argument is afile:URL for a path that does not exist,Paths.get(text)is called where text is afile:URL, which doesn't work - the result is anInvalidPathException. The Windows part is important - this issue only manifests when running on Windows.To fix this issue, also check that the resource isn't a file before calling
Paths.get(). That way, resources that are files skip to the other branch.