Merge branch 'fix-symlinks-windows' of https://github.com/allexendar/calibre

This commit is contained in:
Kovid Goyal 2025-09-27 09:52:38 +05:30
commit 892ed90533
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -104,6 +104,9 @@ class WindowsFileCopier:
def _open_file(self, path: str, retry_on_sharing_violation: bool = True, is_folder: bool = False) -> 'winutil.Handle':
flags = winutil.FILE_FLAG_BACKUP_SEMANTICS if is_folder else winutil.FILE_FLAG_SEQUENTIAL_SCAN
if os.path.islink(path):
# Do not open symbolic link target to prevent unwanted delete_on_close
flags |= 0x00200000 # winutil.FILE_FLAG_OPEN_REPARSE_POINT
access_flags = winutil.GENERIC_READ
if self.delete_all:
access_flags |= winutil.DELETE