You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2021/07/02 10:15:17 UTC
[GitHub] [sling-org-apache-sling-resourceresolver] rombert commented on a change in pull request #48: SLING-10483 Incorrect mapping is returned when a resourceResolver.map is called with all its aliases
rombert commented on a change in pull request #48:
URL: https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/48#discussion_r662903654
##########
File path: src/main/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImpl.java
##########
@@ -150,7 +150,9 @@ public String getMapping(String resourcePath, HttpServletRequest request) {
if (nonDecoratedResource != null) {
List<String> aliases = loadAliasesIfApplicable(nonDecoratedResource);
// avoid duplicating the originally requested path
- aliases.remove(mappedPath);
+ if ( aliases.contains(mappedPath) ) {
Review comment:
This only influences the order of the returned mappings, right? I think the fix is a bit counter-intuitive and makes the (already complicated code) harder to understand.
It would be great if you could find another way to adjust the order.
##########
File path: src/test/java/org/apache/sling/resourceresolver/impl/mapping/ResourceMapperImplTest.java
##########
@@ -110,6 +110,7 @@ public void prepare() throws LoginException {
resourceProvider.putResource("/content/virtual/foo"); // matches virtual.host.com.80 mapping entry
resourceProvider.putResource("/parent", PROP_ALIAS, "alias-parent"); // parent has alias
resourceProvider.putResource("/parent/child", PROP_ALIAS, "alias-child"); // child has alias
+ resourceProvider.putResource("/parent/child/grandChild", PROP_ALIAS, "alias-grandChild"); // grandChild child has alias
Review comment:
Does this reproduce only with 3+ path segments? I think we already have a scenario. with two segments
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org