Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/markitdown/src/markitdown/converters/_exiftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def exiftool_metadata(
f"ExifTool version {version_output} is vulnerable to CVE-2021-22204. "
"Please upgrade to version 12.24 or later."
)
except FileNotFoundError:
return {}
except (subprocess.CalledProcessError, ValueError) as e:
raise RuntimeError("Failed to verify ExifTool version.") from e

Expand All @@ -48,5 +50,7 @@ def exiftool_metadata(
return json.loads(
output.decode(locale.getpreferredencoding(False)),
)[0]
except FileNotFoundError:
return {}
finally:
file_stream.seek(cur_pos)
16 changes: 16 additions & 0 deletions packages/markitdown/tests/test_module_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from unittest.mock import MagicMock

from markitdown._uri_utils import parse_data_uri, file_uri_to_path
from markitdown.converters._exiftool import exiftool_metadata

from markitdown import (
MarkItDown,
Expand Down Expand Up @@ -462,6 +463,21 @@ def test_markitdown_exiftool() -> None:
assert target in result.text_content


def test_exiftool_metadata_ignores_missing_binary() -> None:
stream = io.BytesIO(b"not really an image")

assert exiftool_metadata(stream, exiftool_path="missing-exiftool-binary") == {}
assert stream.tell() == 0


def test_markitdown_missing_exiftool_path_keeps_image_conversion() -> None:
markitdown = MarkItDown(exiftool_path="missing-exiftool-binary")

result = markitdown.convert(os.path.join(TEST_FILES_DIR, "test.jpg"))

assert result.text_content == ""


def test_markitdown_llm_parameters() -> None:
"""Test that LLM parameters are correctly passed to the client."""
mock_client = MagicMock()
Expand Down