-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12 - Simplification of aliases in PathResource
(Take 2)
#8734
Merged
joakime
merged 22 commits into
jetty-12.0.x
from
fix/jetty-12-PathResource-simpler-alias
Oct 19, 2022
Merged
Jetty 12 - Simplification of aliases in PathResource
(Take 2)
#8734
joakime
merged 22 commits into
jetty-12.0.x
from
fix/jetty-12-PathResource-simpler-alias
Oct 19, 2022
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
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…PathResource-resolveTargetPath
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…PathResource-simpler-alias
+ Adding comments about class fields. + Removing normalization from input/output/comparison flows. + Collapsing `resolveTargetPath` into `resolveAlias` to react accordingly to the exceptions that can flow out of Path.toRealPath(). + Failure on Path.toRealPath() is never an alias, as the resource cannot ever be served anyway. + More comments in `resolveAlias()` + Failed / Bad / Nonexistent / Inaccessible resources are not aliases to anything.
gregw
reviewed
Oct 18, 2022
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Show resolved
Hide resolved
gregw
requested changes
Oct 18, 2022
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.
Is this replacing @lachlan-roberts's #8631 ? Oh I see the description says that. OK then...
a couple of niggles....
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/Resource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Outdated
Show resolved
Hide resolved
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/resource/PathResource.java
Outdated
Show resolved
Hide resolved
`targetPath` to `realPath` `targetURI` to `realURI`
lachlan-roberts
approved these changes
Oct 19, 2022
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.
This is an update of PR #8631 to address the PathResource alias checking when it comes to bad resources.
PathResource cleanup
resolveTargetPath
intoresolveAlias
to react accordingly to the exceptions that can flow out ofPath.toRealPath()
.Path.toRealPath()
is never an alias, as the resource cannot ever be served anyway.resolveAlias()
The changes in PR #8702 would impact these changes as we would never even have a Resource that is Failed / Bad / Nonexistent / Inaccessible resources anyway, rendering the extra checks in the
resolveAlias()
flows irrelevant for these kinds of bad resources (they are still relevant for good / accessible resources).