Repository navigation
Keep another font's file when deleting a core font - #2037
Merged
jakejackson1 merged 1 commit intoNov 12, 2026
Merged
Conversation
Contributor
|
Coverage report for commit: 603b801 Summary - Lines: 93.99% | Methods: 90.78% | Branches: 85.75%
🤖 Jest coverage report |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
|
Coverage report for commit: 603b801 Summary - Lines: 90.47% | Methods: 96.02%
🤖 PHPUnit coverage report |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 tasks done
gravitypdf-bot
force-pushed
the
fix/2036-hash-before-deleting-core-font
branch
from
November 12, 2026 00:52
4742863 to
e1e1b78
Compare
Before the sync saves a core font under its hashed name, another font's file of a known size at the font's name passes the size check as the font's own copy, so deleting the family in the Font Manager deleted it. Hash a family file at its plain name before deleting it, and keep it when its SHA-1 isn't a known build. The E2E stand-ins for core fonts are truncated copies of other fonts, so they now go under the hashed name, which is trusted by size. The Multisite test that deletes the file at the plain name copies the manifest's own build there. Refs #2036 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gravitypdf-bot
force-pushed
the
fix/2036-hash-before-deleting-core-font
branch
from
November 12, 2026 02:21
e1e1b78 to
603b801
Compare
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.
Summary
Deleting an unused core font in the Font Manager could delete another font's file. That happens when the other font's file sits at the core font's name and has the size of a known build. Until the background sync saves the core font under its hashed name, the size check counts that file as the font's own copy. Deleting now hashes any family file at its plain name first, and keeps the file when its SHA-1 isn't a known build. Deletes are rare and don't run during a render, so the hashing cost is fine there. This fixes the data-loss part of #2036. #2038 fixes the Site Health and System Report mismatch from that issue.
delete_downloaded_font()drops a plain-name file from the family's paths when its SHA-1 isn't a known build, and logs a notice that it was kept.Try it
DISABLE_WP_CRONtotrue, so the background sync can't save the real font under its hashed name.DejaVuSerifCondensed.ttffrom the manifest, but different contents, atDejaVuSerifCondensed.ttf.Test plan
test_delete_keeps_another_fonts_file_of_a_known_size_at_the_namefails without the fix and passes with it.Test_Downloaded_Fontspasses on single site and Multisite.--filter Font, 734 tests) pass, apart from the twotest_an_unwritable_folder_fails_without_a_requestcases, which also fail ondevelopment.Technical detail
get_core_families()buildspathsfromModel_Font_Sources::get_own_copy(). That check only uses stat calls, because it runs on the render path. It counts a plain-name file as the font's own copy whenever its size is a known build's. The new loop indelete_downloaded_font()runs the downloader's existingis_unknown_build()on each path that equalsget_plain_path( $file ). This is the same git-blob SHA-1 check the sync runs when it verifies a download. A file whose name can't be hashed (get_hashed_name()is'') is treated as the font's own, as before.No other delete path picks its files with the size-only check.
remove_older_hashed_copies()andprune()both hash before they delete.