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 c2pa/c2pa_api/c2pa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Reader(api.Reader):
def __init__(self, format, stream, manifest_data=None):
super().__init__()
if manifest_data is not None:
self.from_manifest_data_and_stream(format, manifest_data, stream)
self.from_manifest_data_and_stream(manifest_data, format, stream)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the stream here also be wrapped in a C2paStream?

Copy link
Contributor

@barnjamin barnjamin Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test modified in this PR will fail with a hash mismatch if validation_status is checked:

self.assertNotIn("validation_status", reader.json())

Wrapping the stream arg before calling init makes the test pass but it seems like it should be done in the Reader init
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed a PR for this so it didn't get lost

else:
self.from_stream(format, C2paStream(stream))

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests.py → tests/test_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_remote_sign(self):
output = io.BytesIO(bytearray())
manifest_data = builder.sign(TestBuilder.signer, "image/jpeg", file, output)
output.seek(0)
reader = Reader.from_manifest_data_and_stream(manifest_data, "image/jpeg", output)
reader = Reader("image/jpeg", output, manifest_data)
self.assertIn("Python Test", reader.json())

if __name__ == '__main__':
Expand Down
Loading