-
-
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
Privacy plugin crashes on HTTP errors #8012
Comments
Potential fix: handle the case of the HTTP failure before trying to parse the |
Thanks for reporting! PR appreciated |
I'd be happy to submit a PR, but would that be OK to raise an exception in that method? |
Yes, of course – as said, I assumed that's done, but thinking about it, a 404 is not an error HTTP request-wise. Thus, since requests follow redirects, we can check if the code is >= 400 (or if no body is present?), raise an error with the HTTP error, which should be caught by the thread pool executor. We need to check what we do with the error – maybe just print it as an warning, and continue without replacing? Not sure. This would allow users that do a |
Ok, I think the errors are currently not caught, but we could expand the respective mkdocs-material/src/plugins/privacy/plugin.py Line 156 in 2752b9e
mkdocs-material/src/plugins/privacy/plugin.py Line 189 in 2752b9e
mkdocs-material/src/plugins/privacy/plugin.py Line 207 in 2752b9e
We should add another method that doesn't just wait, but prints the errors. Also, further testing is necessary to check, that the paths are not replaced when the requests failed. |
I opened PR #8015 It seems that you do not have any unit tests, so I did not add any. I'd be happy to have your review on this PR 🙂
I tested that and everything seems fine. |
Thanks! I'll look into it.
Jup, which historically comes from this project starting out as a theme only 😅 We're in the process of fixing this as part of the foundational work we're currently focusing on, and add proper unit and integration tests. |
Released as part of 9.6.5. |
Thank you! |
Context
I am the maintainer of
fpdf2
and use your excellent theme for our documentation: https://py-pdf.github.io/fpdf2/I enabled the
privacy
plugin yesterday.Bug description
In our GitHub Actions build pipeline, I see frequent (but not systematic) failures like this:
/~https://github.com/py-pdf/fpdf2/actions/runs/13388083737/job/37389293893?pr=1366
On other executions, it sometimes work fine:
/~https://github.com/py-pdf/fpdf2/actions/runs/13387513920/job/37389309336 (retried, the 1st execution failed)
All is fine, but we can see that the
with-pdf
plugin has trouble downloading this image:I suspect that in some cases the HTTP retrieval of the SVG fails, but the plugin still tries to parse the headers ftom the HTTP response, they do not contain any
Content-Type
.In that case, I would expect the
privacy
plugin to skip that<img>
and preserve it as it is.Related links
Reproduction
9.6.4-privacy-plugin-frequent-keyerror-content-type.zip
Steps to reproduce
Repeatedly call
mkdoc build
until it fails.I could not reproduce the failure on my own computer, it only frequently fails in GitHub Actions pipelines.
If this disqualify this bug report, feel free to close it.
Browser
No response
Before submitting
The text was updated successfully, but these errors were encountered: