Skip to content

Commit

Permalink
Apply IgnoreURLs regexs to internal URLs too
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Sep 18, 2021
1 parent 2a7c4c5 commit 01b82dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 1 addition & 3 deletions htmltest/check-link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 9 additions & 0 deletions htmltest/check-link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 01b82dc

Please sign in to comment.