This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-js-provider.git
The following commit(s) were added to refs/heads/master by this push:
new 17cf19e SLING-9599 - Incomplete non-existing resource check
17cf19e is described below
commit 17cf19e2b64b36ad5086428b4babc7ab76fd2006
Author: Radu Cotescu <[email protected]>
AuthorDate: Wed Jul 22 11:42:13 2020 +0200
SLING-9599 - Incomplete non-existing resource check
* delegate normalisation to the ResourceResolver
---
.../sling/scripting/sightly/js/impl/use/DependencyResolver.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git
a/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
b/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
index ab02bc2..6e2f577 100644
---
a/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
+++
b/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
@@ -77,12 +77,8 @@ public class DependencyResolver {
}
if (caller != null && Utils.isJsScript(caller.getName()) &&
("sling/bundle/resource".equals(caller.getResourceType()) ||
"nt:file".equals(caller.getResourceType()))) {
- if (dependency.startsWith(".")) {
- // relative path
- String absolutePath =
ResourceUtil.normalize(caller.getPath() + "/" + dependency);
- if (StringUtils.isNotEmpty(absolutePath)) {
- scriptResource =
scriptingResourceResolver.resolve(absolutePath);
- }
+ if (dependency.startsWith("..")) {
+ scriptResource = caller.getChild(dependency);
} else {
caller = caller.getParent();
if (caller != null) {