Skip to content

Commit

Permalink
Merge branch 'fix/92'
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdp committed Sep 7, 2018
2 parents db89f38 + 39662b0 commit d7bc545
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions htmltest/check-meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ func (hT *HTMLTest) checkMetaRefresh(document *htmldoc.Document, node *html.Node
// Define ref from this
var ref *htmldoc.Reference
if len(contentSplit) == 2 {
if contentSplit[1][0]==34 || contentSplit[1][0]==39 {
hT.issueStore.AddIssue(issues.Issue{
Level: issues.LevelError,
Message: "url in meta refresh must not start with single or double quote",
Reference: ref,
})
return
}

ref = htmldoc.NewReference(document, node, contentSplit[1])
} else {
ref = htmldoc.NewReference(document, node, "")
Expand Down
7 changes: 7 additions & 0 deletions htmltest/check-meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ func TestMetaRefreshContentInvalid(t *testing.T) {
tExpectIssueCount(t, hT3, 1)
tExpectIssue(t, hT3, "invalid content attribute in meta refresh", 1)
}

// Fails when meta refresh url starts with a single or double quote
func TestIssue92(t *testing.T) {
hT := tTestFile("fixtures/meta/issues/92.html")
tExpectIssueCount(t, hT, 2)
tExpectIssue(t, hT, "url in meta refresh must not start with single or double quote", 2)
}
8 changes: 8 additions & 0 deletions htmltest/fixtures/meta/issues/92.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!doctype html>
<html lang="en">
<head>
<title>ox-hugo Test Site</title>
<meta http-equiv="refresh" content="0; URL='https://github.com/kaushalmodi/ox-hugo/issues'" />
<meta http-equiv="refresh" content='0; URL="https://github.com/kaushalmodi/ox-hugo/issues"' />
</head>
</html>

0 comments on commit d7bc545

Please sign in to comment.