wjdp / htmltest

:white_check_mark: Test generated HTML for problems
MIT License
323 stars 54 forks source link

meta refresh info fails to specify affected file #137

Closed brianredbeard closed 3 years ago

brianredbeard commented 4 years ago

Describe the bug

When attempting to use htmltest to check a file I received the following output:

$ htmltest 
htmltest started at 11:49:49 on public
========================================================================
url in meta refresh must not start with single or double quote
url in meta refresh must not start with single or double quote
========================================================================
✘✘✘ failed in 9.020445ms
2 errors in 25 documents

Running this with increased logging allowed me to discover the affected files:

testDocument on media/video/index.html
url in meta refresh must not start with single or double quote
media/video/index.html
...
testDocument on media/photo/index.html
url in meta refresh must not start with single or double quote
media/photo/index.html

Versions

Adding Document: document, to the relevant AddIssue() call in: https://github.com/wjdp/htmltest/blob/8fed7eab083e208dcf6d5788b847084d11c8b207/htmltest/check-meta.go#L34-L38

Resolved the issue:

$ ~/Projects/golang/src/github.com/wjdp/htmltest/bin/htmltest 
htmltest started at 11:55:52 on public
========================================================================
media/video/index.html
  url in meta refresh must not start with single or double quote --- media/video/index.html --> <nil>
media/photo/index.html
  url in meta refresh must not start with single or double quote --- media/photo/index.html --> <nil>
========================================================================
✘✘✘ failed in 22.497733ms
2 errors in 25 documents

I doubt that this is the right answer (it seems through looking through the code that one chooses Document or Reference, but not both) but confirmed that it "works for me". My apologies, If i had the time to dig through the Reference mechanism to submit a "correct" fix I'd be all over it.

wjdp commented 4 years ago

Thanks for the excellent write-up! May be able to take a look hopefully in the next week.

wjdp commented 3 years ago

@brianredbeard You were right, as ref isn't set by the time that issue is created document should have been used instead.