From 01b82dca073de09a0da28e17056c8a6e24dbaabc Mon Sep 17 00:00:00 2001 From: Patrice Chalin Date: Fri, 17 Sep 2021 21:11:46 -0400 Subject: [PATCH] Apply IgnoreURLs regexs to internal URLs too --- htmltest/check-link.go | 4 +--- htmltest/check-link_test.go | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htmltest/check-link.go b/htmltest/check-link.go index 5f89f15..9a81ef2 100644 --- a/htmltest/check-link.go +++ b/htmltest/check-link.go @@ -277,11 +277,9 @@ func (hT *HTMLTest) checkInternal(ref *htmldoc.Reference) { return } - // Solve #168 urlStr := ref.URLString() - // Does this internal url match a internal url ignore rule? - if hT.opts.isInternalURLIgnored(urlStr) { + if hT.opts.isInternalURLIgnored(urlStr) || hT.opts.isURLIgnored(urlStr) { return } diff --git a/htmltest/check-link_test.go b/htmltest/check-link_test.go index bc468e9..16f6e04 100644 --- a/htmltest/check-link_test.go +++ b/htmltest/check-link_test.go @@ -319,6 +319,15 @@ func TestAnchorInternalBrokenIgnore(t *testing.T) { tExpectIssueCount(t, hT, 0) } +func TestAnchorInternalBrokenIgnoreUrl(t *testing.T) { + // ignores links in IgnoreURLs + hT := tTestFileOpts("fixtures/links/brokenLinkInternal.html", + map[string]interface{}{ + "IgnoreURLs": []interface{}{"no\\w+.html"}, + }) + tExpectIssueCount(t, hT, 0) +} + func TestAnchorInternalRelativeLinksBase(t *testing.T) { // passes for relative links with a base hT := tTestFile("fixtures/links/relativeLinksWithBase.html")