Skip to content

Commit 0acd200

Browse files
committed
fix(fileex.file.content): only consider "file" paths as valid path, not directory paths.
1 parent d4e8f81 commit 0acd200

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ namespaces = true
1515

1616
# ----------------------------------------- Project Metadata -------------------------------------
1717
[project]
18-
version = "0.2.9"
18+
version = "0.2.10"
1919
name = "FileEx"
2020
requires-python = ">=3.10"

pkg/src/fileex/file.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def return_from_str(s: str) -> str | bytes:
146146
# String: check if path or content
147147
if isinstance(file, str):
148148
if path_can_be_str and fileex.path.is_path(file):
149-
return return_from_bytes(Path(file).read_bytes())
149+
filepath = Path(file)
150+
if filepath.is_file():
151+
return return_from_bytes(filepath.read_bytes())
150152
return return_from_str(file)
151153

152154
# Bytes-like: normalize to bytes

0 commit comments

Comments
 (0)