-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix #8012 - Privacy plugin crashes on HTTP errors #8015
Conversation
I currently have errors like this that I need to figure how to fix:
|
I think this is now ready for reviewing, I fixed all problematic casesI could find. However, from the logs, it seems that all failing HTTP requests are performed twice: is this normal? |
Thanks for the PR! Before I review this
Please don't do this and please stick to the current style. We'll switch to code formatting in the future (although we're likely going for ruff), but right now, this will break the conventions that we use. Nothing is worse than unfollowed conventions, although the conventions might be debatable. Once those are out, we can discuss the changes. |
With the current design of the privacy plugin, yes. It first tries to fetch all resources from Markdown, which it does in parallel, and when pages are rendered, does a second pass to catch all resources from the templates. This allows to make some requests in parallel, because when the page is built, we need to wait for the downloads to complete. This is not ideal, but a limitation of MkDocs plugin API, since we only get the hooks that there are. We could mark resources that we downloaded for "did not work", but it might be temporary, so I'd say we just leave it at that, since it's nothing that impact functionality. The build should probably fail anyway, so the author can fix it. |
I reverted the formatting changes.
That's fine with me. The reason I think this is the "good" default behaviour is because a link will become "broken" for reasons outside the scope of a documentation source code. That means that, if we failed the build in case of broken links, for 2 consecutive "builds" of the same documentation, one could end up with a ✅ success and then just after with a ❌ failure. IMHO this is not good design, because it could lead to non-reproductible / unstable builds. But an optional toggle is fine for people who would like to be "strict" about broken links. What do you think about this? PS: as a side note / humble feedback, having the same source file duplicated twice in a source code is not really ideal / DRY. Maybe you could have a simple "copy" step during the build process for this theme, so that |
No need, just run
Thanks for your remarks. I agree. The theme must be installable from git, but yes, it's annoying. However, the |
Thanks! LGTM. |
I tested manually this change and it works fine for my case:
I also tested providing an non-resolvable URL as image, and one that only answers after a long delay, and those cases are well handled now.
There is a test file you can use:
I ran
black
on the source files, which caused several unrelated changes.