Mailto check failed in some cases
Atarity opened this issue · comments
Source: <a href="mailto:mike@snnkv.com">mike@snnkv.com</a>
Result:
[14:40:12] htmlProofer: * At _site/now/index.html:87:
[14:40:12] htmlProofer:
[14:40:12] htmlProofer: mailto:mike@snnkv.com contains an invalid email address
While I change domain name a bit (eg @snkv.com
or @snnnkv.com
) it pass the test. The problem is: it is impossible to just turn such check off, so htmlproofer became useless for me since v4.
@Atarity, I cannot reproduce with v4.4.0 using the following mailto.html
<!DOCTYPE html>
<html>
<body>
<a href="mailto:mike@snnkv.com">mike@snnkv.com</a>
<a href="mailto:mike@snkv.com">mike@snkv.com</a>
<a href="mailto:mike@snnnkv.com">mike@snnnkv.com</a>
</body>
</html>
bundle exec htmlproofer mailto.html
# HTML-Proofer finished successfully
Are you perhaps using other options that might interfere with the check?
The problem is: it is impossible to just turn such check off
You can do so via --ignore-urls "/^mailto:/"
Hope this helps
Thanks for --ignore-urls
workaround. Yes, I actually use lots of other options:
--extension .html
--assume-extension .html
--checks "Links,Scripts,OpenGraph"
--enforce-https=false
--ignore-status-codes "999,401"
--disable-external=true
--ignore-urls "/^mailto:/"
I'm using Gulp for automation.
None of the options seem to interfere with the minimal example above... even with those flags the issue cannot be reproduced.
Hard to investigate if not reproducible, you can perhaps try updating all gems.
I performed one more test. Took basic mailto.html
you provided above. Process the file with htmlproofer
as you do. Success. But as soon as I check this file as a part of my website it is the same result. It is failed in only one email address out of 3.
[10:53:44] htmlProofer: For the Links check, the following failures were found:
[10:53:44] htmlProofer:
[10:53:44] htmlProofer: * At _site/mailto.html:4:
[10:53:44] htmlProofer:
[10:53:44] htmlProofer: mailto:mike@snnkv.com contains an invalid email address
I understand it is hard to reproduce. Maybe it is a problem with my Gulp configuration. I'll try to investigate it later.
Btw, while repo have discussion feature turned off, I have off topic question: I need to check images, but my images have no src
argument. They have data-src
instead. Obviously it can be swapped with --swap-attributes
option, but I can't managed to pass valid json as a config option. How syntax should look like for a CLI?
Ok, solved. Above I copy to you all options from my CI/CD config, but locally I've used one more: --swap-urls snnkv.com:localhost:4000
. That means htmlproofer swap mike@snnkv.com
to mike@localhost:4000
which doesn't seem a valid email address. I've confused because of mistake pointed to original address, not a swapped one.
I think we can close the issue. That is enough email addresses published on GitHub. 😂
need to check images, but my images have no src argument. They have data-src instead. Obviously it can be swapped with --swap-attributes option, but I can't managed to pass valid json as a config option. How syntax should look like for a CLI?
This case is even covered by unit tests:
When used at the command-line directly, no escaping \"
is needed so
--swap-attributes '{"img": [["src", "data-src"]] }'
would do.
There is actually an inconsistency in the README about swap_attributes
, where one could probably better use the data-src
example. I will open a PR for @gjtorikian to review and possibly integrate a README change.
It might be a good idea to close this issue as nothing is really open here anymore, and in case open new dedicated issues for additional topics.