diff --git a/htmltest/check-meta.go b/htmltest/check-meta.go index 6db53e4..f4d50e5 100644 --- a/htmltest/check-meta.go +++ b/htmltest/check-meta.go @@ -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, "") diff --git a/htmltest/check-meta_test.go b/htmltest/check-meta_test.go index 777c0ef..921462b 100644 --- a/htmltest/check-meta_test.go +++ b/htmltest/check-meta_test.go @@ -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) +} diff --git a/htmltest/fixtures/meta/issues/92.html b/htmltest/fixtures/meta/issues/92.html new file mode 100644 index 0000000..f49d065 --- /dev/null +++ b/htmltest/fixtures/meta/issues/92.html @@ -0,0 +1,8 @@ + + + + ox-hugo Test Site + + + +