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
8 changes: 7 additions & 1 deletion b2sdk/_internal/scan/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import platform
import re
import stat
import sys
from abc import ABCMeta, abstractmethod
from pathlib import Path
Expand Down Expand Up @@ -274,14 +275,19 @@ def _walk_relative_paths(
reporter.invalid_name(str(local_path), str(e))
continue

# Deliberately don't use Path.is_dir here: for directories
# without search permission, Python 3.13 raises PermissionError
# while Python 3.14 returns False.
try:
is_dir = local_path.is_dir()
is_dir = stat.S_ISDIR(local_path.stat().st_mode)
except PermissionError: # `chmod -x dir` can trigger this
if reporter is not None and not policies_manager.should_exclude_local_directory(
str(relative_file_path)
):
reporter.local_permission_error(str(local_path))
continue
except (OSError, ValueError):
is_dir = False

if is_dir:
if policies_manager.should_exclude_local_directory(str(relative_file_path)):
Expand Down
1 change: 1 addition & 0 deletions changelog.d/+py314-test.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `TestFolderTraversal.test_dir_without_exec_permission` on Python 3.14.