diff --git a/htmltest/check-generic.go b/htmltest/check-generic.go index 933384e..2504ab4 100644 --- a/htmltest/check-generic.go +++ b/htmltest/check-generic.go @@ -45,6 +45,11 @@ func (hT *HTMLTest) checkGenericRef(ref *htmldoc.Reference) { } func (hT *HTMLTest) enforceHTTPS(ref *htmldoc.Reference) { + // Does this url match an url ignore rule? + if hT.opts.isURLIgnored(ref.URLString()) { + return + } + if hT.opts.EnforceHTTPS { hT.issueStore.AddIssue(issues.Issue{ Level: issues.LevelError, diff --git a/htmltest/check-link_test.go b/htmltest/check-link_test.go index 741aace..61a3eac 100644 --- a/htmltest/check-link_test.go +++ b/htmltest/check-link_test.go @@ -26,7 +26,6 @@ func TestAnchorIgnorableChildren(t *testing.T) { tExpectIssueCount(t, hT, 0) } - func TestAnchorMatchIgnore(t *testing.T) { // ignores links in IgnoreURLs hT := tTestFileOpts("fixtures/links/brokenLinkExternalSingle.html", @@ -104,6 +103,16 @@ func TestAnchorExternalInsecureOption(t *testing.T) { tExpectIssue(t, hT, "is not an HTTPS target", 1) } +func TestAnchorExternalInsecureOptionIgnored(t *testing.T) { + // passes when checking for non-HTTPS links but they're in the IgnoreURLs list + hT := tTestFileOpts("fixtures/links/issues/94.html", + map[string]interface{}{ + "EnforceHTTPS": true, + "IgnoreURLs": []interface{}{"plantuml.com", "plantuml.net", "forum.plantuml.net"}, + }) + tExpectIssueCount(t, hT, 0) +} + func TestAnchorExternalHrefIP(t *testing.T) { // fails for broken IP address links hT := tTestFileOpts("fixtures/links/ip_href.html", diff --git a/htmltest/fixtures/links/issues/94.html b/htmltest/fixtures/links/issues/94.html new file mode 100644 index 0000000..b505629 --- /dev/null +++ b/htmltest/fixtures/links/issues/94.html @@ -0,0 +1,11 @@ + + + + +Source +http://plantuml.com/class-diagram +
Source +
+Source + +