Repository navigation
Conversation
Gracefully handle corrupted EXIF GPS tags with zero denominators in _convert_to_degrees and catch ZeroDivisionError in _extract_gps_coordinates to prevent backend scanner crashes. Add unit tests for zero denominators and plain float coordinates.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the
|
This branch has not been deployed
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 of Changes
Corrupted or non-standard image files containing EXIF GPS metadata with rational denominators equal to zero caused
_convert_to_degreesto raise an unhandledZeroDivisionError. BecauseZeroDivisionErrorinherits fromArithmeticErrorrather thanValueError, the exception was not caught by theexceptblock in_extract_gps_coordinates, causingimage_util_extract_metadatato fail and aborting photo scans.Implementation Details:
_convert_to_degrees:v.denominator == 0.0when processing rational EXIF structures and raisedZeroDivisionErrorwith an informative error message._extract_gps_coordinates:ZeroDivisionErrorto the exception tuple in_extract_gps_coordinatesso malformed GPS tags fallback gracefully to(None, None)without terminating the broader metadata extraction or image scan.backend/tests/test_extract_location_metadata.pycovering zero-denominator rational tuples, valid rationals, and non-rational (plain float/int) coordinates.Fixes #1535