This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 4084147 SLING-9406 - Add bundled script support to the servlets
resolver
4084147 is described below
commit 4084147cd775d686073ddc5120fff435dc54b621
Author: Karl Pauls <[email protected]>
AuthorDate: Mon May 18 15:27:51 2020 +0200
SLING-9406 - Add bundled script support to the servlets resolver
* Only set the resource metadata in the decorator if needed.
---
.../sling/servlets/resolver/internal/ScriptResourceDecorator.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/src/main/java/org/apache/sling/servlets/resolver/internal/ScriptResourceDecorator.java
b/src/main/java/org/apache/sling/servlets/resolver/internal/ScriptResourceDecorator.java
index 5034cdc..a780b9a 100644
---
a/src/main/java/org/apache/sling/servlets/resolver/internal/ScriptResourceDecorator.java
+++
b/src/main/java/org/apache/sling/servlets/resolver/internal/ScriptResourceDecorator.java
@@ -44,15 +44,20 @@ public class ScriptResourceDecorator implements
ResourceDecorator {
@Override
public Resource decorate(Resource resource) {
String path = resource.getPath();
+ String resolutionPath =
resource.getResourceMetadata().getResolutionPath();
Resource script = getResource(resource, path);
if (script == resource &&
Resource.RESOURCE_TYPE_NON_EXISTING.equals(resource.getResourceType())) {
int idx = path.indexOf('.');
if (idx != -1) {
path = path.substring(0, idx);
script = getResource(resource, path);
+ resolutionPath = path;
}
}
- script.getResourceMetadata().putAll(resource.getResourceMetadata());
+ if (script != resource) {
+
script.getResourceMetadata().putAll(resource.getResourceMetadata());
+ script.getResourceMetadata().setResolutionPath(resolutionPath);
+ }
return script;
}