Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion imgparse/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_xmp_data(
file_so_far = current_data.decode("latin_1")
end_match = re.search(XMP_END, file_so_far)
if end_match:
match = re.search(FULL_XMP, file_so_far)
match = re.search(FULL_XMP, file_so_far[: end_match.end()])
if match:
xmp_str = match.group(0)
break
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "imgparse"
version = "2.0.6"
version = "2.0.7"
description = "Python image-metadata-parser utilities"
authors = []
include = [
Expand Down
Binary file added tests/data/2xmpendtags.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions tests/test_imgparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ def s3_image_parser() -> MetadataParser:
)


@pytest.fixture
def two_xmp_end_tags_parser() -> MetadataParser:
return MetadataParser(base_path / "2xmpendtags.jpg")


def test_get_camera_params_dji(dji_parser: MetadataParser) -> None:
pitch1 = dji_parser.pixel_pitch_meters()
focal1 = dji_parser.focal_length_meters()
Expand Down Expand Up @@ -671,3 +676,9 @@ def s3_chunk_side_effect(Range=None, **kwargs): # type: ignore
s3_image_parser._xmp_data = None
s3_image_parser._raw_data = b""
s3_image_parser.rotation()


def test_multiple_xmp_end_tags(
two_xmp_end_tags_parser: MetadataParser,
) -> None:
assert two_xmp_end_tags_parser.xmp_data is not None