Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of PurePosixPath in PDFReader #16612

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging
import struct
import zlib
from pathlib import Path
from pathlib import Path, PurePosixPath
from typing import Any, Dict, List, Optional

from tenacity import retry, stop_after_attempt
Expand Down Expand Up @@ -43,8 +43,8 @@ def load_data(
fs: Optional[AbstractFileSystem] = None,
) -> List[Document]:
"""Parse file."""
if not isinstance(file, Path):
file = Path(file)
if not isinstance(file, Path) and not isinstance(file, PurePosixPath):
file = PurePosixPath(file)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should only be using PurePosixPath when fs is some remote file system -- and probably only in simple directory reader?


try:
import pypdf
Expand Down