diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java index 5345cbc8..b87483a8 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java @@ -227,6 +227,11 @@ public static boolean isLocalResource(String link) { throw new InvalidUriSyntaxException(e); } + if (null == aUri.getPath()) { + log.warn("'{}' does not have a valid (URI) path", link); + return false; + } + return ( (isLinkToFile(aUri)) // (1) || diff --git a/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/tools/WebSpec.groovy b/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/tools/WebSpec.groovy index fcd4064d..7ae7e556 100644 --- a/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/tools/WebSpec.groovy +++ b/htmlSanityCheck-core/src/test/groovy/org/aim42/htmlsanitycheck/tools/WebSpec.groovy @@ -108,6 +108,7 @@ class WebSpec extends Specification { false | "10.0.0.1/index.html" // this is a valid REMOTE address, defaults to http or https false | "javascript:dummy" + false | "xmxaxixlxtxo:ixnxfxox@xaxrxcx4x2x.xdxex" } @Unroll @@ -116,7 +117,7 @@ class WebSpec extends Specification { Web.isLocalResource(invalidUri) then: - thrown(Web.InvalidUriSyntaxException) + thrown(InvalidUriSyntaxException) where: invalidUri << [