mdify-cli 2.0.0__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Convert PDFs and document images into structured Markdown for LLM workflows
5
5
  Author: tiroq
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """mdify - Convert documents to Markdown via Docling container."""
2
2
 
3
- __version__ = "2.0.0"
3
+ __version__ = "2.1.0"
@@ -571,9 +571,15 @@ def main() -> int:
571
571
  print(f"Run with --pull=missing or pull manually: {preferred} pull {image}")
572
572
  return 1
573
573
 
574
- # Resolve paths
575
- input_path = Path(args.input).resolve()
576
- output_dir = Path(args.out_dir).resolve()
574
+ # Resolve paths (use absolute() as fallback if resolve() fails due to permissions)
575
+ try:
576
+ input_path = Path(args.input).resolve()
577
+ except PermissionError:
578
+ input_path = Path(args.input).absolute()
579
+ try:
580
+ output_dir = Path(args.out_dir).resolve()
581
+ except PermissionError:
582
+ output_dir = Path(args.out_dir).absolute()
577
583
 
578
584
  # Validate input
579
585
  if not input_path.exists():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdify-cli
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Convert PDFs and document images into structured Markdown for LLM workflows
5
5
  Author: tiroq
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mdify-cli"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "Convert PDFs and document images into structured Markdown for LLM workflows"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.8"
@@ -1,6 +1,7 @@
1
1
  """Tests for mdify CLI runtime detection."""
2
2
 
3
3
  import sys
4
+ from pathlib import Path
4
5
  from unittest.mock import patch, Mock
5
6
  import pytest
6
7
 
@@ -135,3 +136,50 @@ class TestNewCLIArgs:
135
136
  with patch.object(sys, "argv", ["mdify", "--port", "65535", "test.pdf"]):
136
137
  args = parse_args()
137
138
  assert args.port == 65535
139
+
140
+
141
+ class TestPathResolution:
142
+ """Tests for path resolution error handling."""
143
+
144
+ def test_input_path_permission_error_fallback(self, tmp_path):
145
+ """Test that PermissionError on resolve() falls back to absolute()."""
146
+ test_file = tmp_path / "test.pdf"
147
+ test_file.write_bytes(b"%PDF-1.4 test")
148
+
149
+ original_resolve = Path.resolve
150
+
151
+ def mock_resolve(self, strict=False):
152
+ if "test.pdf" in str(self):
153
+ raise PermissionError("Operation not permitted")
154
+ return original_resolve(self, strict=strict)
155
+
156
+ with patch.object(Path, "resolve", mock_resolve):
157
+ with patch.object(sys, "argv", ["mdify", str(test_file)]):
158
+ with patch("mdify.cli.detect_runtime", return_value=None):
159
+ from mdify.cli import main
160
+
161
+ result = main()
162
+ assert result == 1
163
+
164
+ def test_output_path_permission_error_fallback(self, tmp_path):
165
+ """Test that PermissionError on output path resolve() falls back to absolute()."""
166
+ test_file = tmp_path / "test.pdf"
167
+ test_file.write_bytes(b"%PDF-1.4 test")
168
+ output_dir = tmp_path / "output"
169
+
170
+ original_resolve = Path.resolve
171
+
172
+ def mock_resolve(self, strict=False):
173
+ if "output" in str(self):
174
+ raise PermissionError("Operation not permitted")
175
+ return original_resolve(self, strict=strict)
176
+
177
+ with patch.object(Path, "resolve", mock_resolve):
178
+ with patch.object(
179
+ sys, "argv", ["mdify", str(test_file), "-o", str(output_dir)]
180
+ ):
181
+ with patch("mdify.cli.detect_runtime", return_value=None):
182
+ from mdify.cli import main
183
+
184
+ result = main()
185
+ assert result == 1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes