HTTPS localhost URLs are not ignored
johnthagen opened this issue ยท 7 comments
If a page contains:
!!! note
Connect to <https://localhost/admin>
The following error is logged:
ERROR - Error building page 'page.md': https://localhost: -1
https://localhost/admin: -1
Traceback (most recent call last):
File ".tox/docs/bin/mkdocs", line 8, in <module>
sys.exit(cli())
File ".tox/docs/lib/python3.9/site-packages/click/core.py", line 1134, in __call__
return self.main(*args, **kwargs)
File ".tox/docs/lib/python3.9/site-packages/click/core.py", line 1059, in main
rv = self.invoke(ctx)
File ".tox/docs/lib/python3.9/site-packages/click/core.py", line 1665, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File ".tox/docs/lib/python3.9/site-packages/click/core.py", line 1401, in invoke
return ctx.invoke(self.callback, **ctx.params)
File ".tox/docs/lib/python3.9/site-packages/click/core.py", line 767, in invoke
return __callback(*args, **kwargs)
File ".tox/docs/lib/python3.9/site-packages/mkdocs/__main__.py", line 152, in build_command
build.build(config.load_config(**kwargs), dirty=not clean)
File ".tox/docs/lib/python3.9/site-packages/mkdocs/commands/build.py", line 292, in build
_build_page(file.page, config, files, nav, env, dirty)
File ".tox/docs/lib/python3.9/site-packages/mkdocs/commands/build.py", line 213, in _build_page
output = config['plugins'].run_event(
File ".tox/docs/lib/python3.9/site-packages/mkdocs/plugins.py", line 94, in run_event
result = method(item, **kwargs)
File ".tox/docs/lib/python3.9/site-packages/htmlproofer/plugin.py", line 36, in on_post_page
raise Exception(error)
Exception: https://localhost: -1
And nothing is running on localhost
(and connections will receive a TCP reset), it doesn't seem possible to ignore the error:
plugins:
- search
- htmlproofer:
raise_error: True
raise_error_excludes:
-1: ["https://localhost/admin"]
Even with this, the error is still present. How would one suppress this?
Environment
macOS
Python 3.9.5
mkdocs-htmlproofer-plugin 0.3.0
Thanks for reporting. I might only have time to look into it during weekend.
@manuzhang Just checking if there is anything that can be done to help this along. Thanks.
It will be great if you can help with a PR.
Doing a quick glance through the code, perhaps the issue is that in my case I'm using https://
localhost URLs but this logic is only configured to special case http://
?
Perhaps this could be improved by using a regex that checks for http
or https
like is done here:
@johnthagen,
Thanks for helping out while I spent the weekend watching European Football. ๐
spent the weekend watching European Football
Of course! We should all get to enjoy the weekend. ๐ I'm glad the fix turned out to be fairly simple in this case.