-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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 handling of "file:" paths to non-existent files on Windows #26575
Merged
Conversation
This file contains 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
spring-projects-issues
added
the
status: waiting-for-triage
An issue we've not yet triaged or decided on
label
Feb 20, 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.
I've added some tests to |
candrews
changed the title
Fix handling of file: paths to non-existent files
Fix handling of file: paths to non-existent files on Windows
Feb 20, 2021
jhoeller
added
in: core
Issues in core modules (aop, beans, core, context, expression)
type: bug
A general bug
and removed
status: waiting-for-triage
An issue we've not yet triaged or decided on
labels
Feb 22, 2021
jhoeller
changed the title
Fix handling of file: paths to non-existent files on Windows
Fix handling of "file:" paths to non-existent files on Windows
Feb 22, 2021
spring-projects-issues
added
status: backported
An issue that has been backported to maintenance branches
and removed
for: backport-to-5.2.x
labels
Feb 22, 2021
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
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.