-
-
Notifications
You must be signed in to change notification settings - Fork 884
V3 Use EXIF byte order for EXIF encoded strings. #2944
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request backports changes to ensure that EXIF encoded strings are interpreted using the EXIF byte order. Key changes include:
- Addition of a new test case for Issue2906.
- Updates to ExifEncodedString and ExifEncodedStringHelpers to handle a ByteOrder parameter.
- Adjustments to ExifReader and ExifTag for improved endianness management.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/Images/Input/Webp/issues/Issue2906.webp | Adds a new Git LFS pointer file for testing. |
tests/ImageSharp.Tests/TestImages.cs | Registers the new test image constant. |
tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs | Introduces a new test verifying proper decoding for Issue2906. |
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifEncodedString.cs | Adds a ByteOrder overload for TrySetValue and defaults to LittleEndian in the parameterless override. |
src/ImageSharp/Metadata/Profiles/Exif/Tags/ExifTag.cs | Updates equality operators to handle nullable values. |
src/ImageSharp/Metadata/Profiles/Exif/ExifReader.cs | Refactors endianness handling, ensuring ByteOrder is set based on IsBigEndian. |
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs | Updates methods to accept and use ByteOrder, with BOM detection logic for Unicode. |
Comments suppressed due to low confidence (2)
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs:105
- Consider parameterizing or deriving the ByteOrder for GetDataLength to reflect the actual EXIF byte order, rather than defaulting to LittleEndian.
(uint)GetEncoding(encodedString.Code, ByteOrder.LittleEndian).GetByteCount(encodedString.Text) + CharacterCodeBytesLength;
src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs:112
- Consider using the actual EXIF byte order for encoding the string in Write, instead of hardcoding LittleEndian, to ensure consistency with the rest of the EXIF handling.
int count = Write(GetEncoding(encodedString.Code, ByteOrder.LittleEndian), text, destination[CharacterCodeBytesLength..]);
Prerequisites
Description
Fixes #2906
A backport of #2943 for V3.