From 606a6129aac8cc027fa2ba00e6dd9c65e1a99ad1 Mon Sep 17 00:00:00 2001
From: Maciej Lech <maciej.lech@reef.pl>
Date: Tue, 26 Nov 2024 22:38:33 +0100
Subject: [PATCH] Fix file permission handling on windows

---
 b2sdk/_internal/scan/folder.py                   | 2 +-
 changelog.d/+fix_perms_handling_for_win.fixed.md | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 changelog.d/+fix_perms_handling_for_win.fixed.md

diff --git a/b2sdk/_internal/scan/folder.py b/b2sdk/_internal/scan/folder.py
index d5a6e578..d1a70963 100644
--- a/b2sdk/_internal/scan/folder.py
+++ b/b2sdk/_internal/scan/folder.py
@@ -114,7 +114,7 @@ def _file_read_access(path):
         try:
             with open(path, 'rb', buffering=0):
                 return True
-        except PermissionError:
+        except (FileNotFoundError, PermissionError):
             return False
 else:
 
diff --git a/changelog.d/+fix_perms_handling_for_win.fixed.md b/changelog.d/+fix_perms_handling_for_win.fixed.md
new file mode 100644
index 00000000..8338816c
--- /dev/null
+++ b/changelog.d/+fix_perms_handling_for_win.fixed.md
@@ -0,0 +1 @@
+Fix file/directory permission handling for Windows during the B2 sync.