fix: handle PermissionError for directory input on Windows CLI#3149
Merged
ceberam merged 2 commits intodocling-project:mainfrom Mar 19, 2026
Merged
Conversation
On Windows, Path.read_bytes() on a directory raises PermissionError instead of IsADirectoryError (which is raised on Linux/macOS). This caused the CLI to crash when a directory was passed as input source. Catch PermissionError alongside IsADirectoryError so directory inputs are handled correctly on all platforms. Fixes docling-project#3138 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
✅ DCO Check Passed Thanks @joaquinhuigomez, all your commits are properly signed off. 🎉 |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
I, Joaquin Hui Gomez <joaquinhui1995@gmail.com>, hereby add my Signed-off-by to this commit: 90c738c Signed-off-by: Joaquin Hui Gomez <joaquinhui1995@gmail.com>
Member
|
I see duplicate PR (#3145) |
2 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Member
|
Duplicate of #3140 |
ceberam
approved these changes
Mar 19, 2026
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
Fixes #3138
On Windows,
Path.read_bytes()raisesPermissionErrorwhen called on a directory path, while Unix raisesIsADirectoryError. This causes the CLI to crash when processing directory inputs on Windows.Fix: Add
PermissionErrorto the existingexcept IsADirectoryErrorclause indocling/cli/main.py:657. The subsequentlocal_path.is_dir()check on line 661 already validates the path is actually a directory, so a genuine file permission error would not pass that guard.Test plan
is_dir()guard on line 661 prevents false positives from real permission errors