Repository navigation
Fix image metadata on Thai-locale computers (BL-16926) - #8413
Conversation
|
[Claude Opus 5.5 from Andrew Polk's machine during preflight] Consulted Devin on 2026-09-25 22:25 UTC up to commit 8cd8588: no bugs, no flags. |
|
[Medium risk] Adds a workaround for image metadata handling on Thai-locale systems. The PR appears safe to merge. SummaryThe PR registers a TagLib# file-type resolver at startup to restore image metadata handling under Thai collation.
Reviews (3) · Last reviewed commit: "Fix image metadata on Thai-locale comput..." |
8cd8588 to
2d22c56
Compare
|
[Claude Opus 5.5 from Andrew Polk's machine] Re Greptile's summary: added JPEG cases to both regression tests (amended into 2d22c56). Kept the NLS premise check as a hard failure on purpose: on a runtime whose Thai collation finds the period the tests couldn't reproduce the bug, and a loud failure beats a silent pass. .NET 8 on current Windows uses ICU. |
|
[Claude Opus 5.5 from Andrew Polk's machine] Consulted Devin on 2026-09-25 23:02 UTC up to commit 2d22c56: no bugs, no flags. |
TagLib# finds a file's extension with a culture-sensitive LastIndexOf, which ignores the period under Thai collation, so every image metadata read/write threw UnsupportedFormatException. Register a TagLib FileTypeResolver at startup that redoes the lookup with Path.GetExtension; it covers libpalaso's calls and Bloom's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2d22c56 to
d23dd7c
Compare
|
[Claude Opus 5.5 from Andrew Polk's machine during preflight] Consulted Devin on 2026-09-29 16:16 UTC up to commit d23dd7c (the fix rebased onto Version6.4): no bugs, no flags. |
Problem. On a computer whose regional format is Thai (probably Lao too), every Bloom operation that reads or writes the credits/license metadata inside an image fails with
UnsupportedFormatException. That covers choosing a picture, editing its credits, anything that saves images with metadata, and every book's cover thumbnail: selecting a book replaces its thumbnail with the hazard sign (BL-16944; in a debug build it trips an assert and Bloom exits). The culture sweep's th-TH leg found it. Targets Version6.4.Cause. When TagLib# isn't given a mime type, it works one out from the file name with a culture-sensitive
LastIndexOf("."). Under Thai ICU collation the period is ignorable, so the extension comes out empty and the mime type istaglib/. libpalaso's ClearShare code and Bloom's own code both callTagLib.File.Create(path).Fix.
FileTypeResolver(TagLib's own extension point) at the top ofProgram.Main. When TagLib's mime type is unknown but the extension found withPath.GetExtensionis known, the resolver creates the file with the right mime type. Otherwise it stays out of the way, so mislabeled and unsupported files behave as before. One registration covers libpalaso's calls and Bloom's own direct calls. It can be removed once a TagLib# release searches ordinally (upstream fix: Find the file extension ordinally in File.Create mono/taglib-sharp#381).[SetUpFixture], as Program does. New th-TH regression tests (PNG and JPEG) cover the libpalaso save/read path and Bloom'sRobustFileIO.CreateTaglibFile. They first check that the runtime really ignores the period, so they can't pass for nothing.Ref: https://issues.bloomlibrary.org/youtrack/issue/BL-16926
🤖 Generated with Claude Code
Devin review
This change is