Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External links cache not updated for failures (next-gen) #683

Closed
riccardoporreca opened this issue Jan 2, 2022 · 2 comments · Fixed by #685
Closed

External links cache not updated for failures (next-gen) #683

riccardoporreca opened this issue Jan 2, 2022 · 2 comments · Fixed by #685

Comments

@riccardoporreca
Copy link
Collaborator

Using the GitHub "next-gen" version of html-proofer, if a failure is detected and cached, it is not updated if the link is OK upon a re-run, which implies the link will be always checked

Example:

echo '<!doctype html>
<html>
<head><title>Example</title></head>`
<body>
<a href="https://github.com/gjtorikian/html-proofer">The amazing HTMLProofer</a>
</body>
</html>' > example.html

Create a cache with a failure

echo \
'{"version":2,"internal":{},"external":{"https://github.com/gjtorikian/html-proofer":{"time":"2022-01-02 20:41:00 +0100","found":false,"status_code":0,"message":"error","metadata":[{"filename":"example.html","line":5}]}}}' \
> example_cache/cache.json

Running several times, the link is always re-checked successfully (Received a 200 for https://github.com/gjtorikian/html-proofer) because the cache file is not updated

htmlproofer --cache '{"timeframe": "1d", "storage_dir": "example_cache"}' --log-level debug example.html
@riccardoporreca
Copy link
Collaborator Author

I guess the if @cache_log[:external][url].nil? is preventing the update

@cache_log[:external][url] = { time: @cache_time, found: found, status_code: status_code, message: msg, metadata: [] } if @cache_log[:external][url].nil?

@gjtorikian
Copy link
Owner

Thank you so so much for finding this. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants