fix: eliminate dead uid scale URLs under volatile ThumborScaleStorage - #18
Merged
Merged
Conversation
#17) - Add _skip_type_fallback_url() helper to generate field URLs with optional cache busters - SVG images fall back to field URL (browsers scale vectors themselves) - Cache buster uses data.modified (field) or context._p_mtime (content) - Wire fallback in ThumborImageScale.__init__ (legacy path), ThumborImageScale._scale_url, and ThumborImageScaling._scale_url - Add four new tests covering field URL behavior and cache busters Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ocs drift) Also mark up zope2.Public as inline code in a security-doc heading so vale (pre-commit, changed-files-only) passes again. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17.
Root cause (see the correction comment on the issue): the volatile
ThumborScaleStoragemakes every uid-based scale URL unresolvable —get_or_generatereads a fresh empty per-instance dict on traversal.purge_scaleswas a red herring.Two-pronged fix:
Never emit uid URLs. Skip-Thumbor types (SVG) get the original
field URL +
?v=<modified-millis>cache buster, wired into bothplone.namedfile code paths (legacy
__init__for 7.x — the pinnedversion, where
_scale_urlis never called — and_scale_urlforHeal uid URLs already in the wild (cached HTML, stale
image_scalescatalog metadata):get_or_generateparses thedeterministic
{fieldname}-{width}-{md5}uid and regenerates theinfo on the fly. Raster heals to a 302 → Thumbor, SVG serves the
original field bytes. Only widths registered in
plone.allowed_sizesare accepted (width 0 = original), so arbitrary dimensions cannot be
signed on demand.
Ops note: no reindex strictly required thanks to (2), but a one-off
image_scalesreindex after deploy stops stale uid URLs from beingserved in fresh catalog-driven listings.
🤖 Generated with Claude Code