From d2cd60f9e6a876eb8076e8a5c6af498dbe620750 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 7 Mar 2025 07:53:32 +0530 Subject: [PATCH] Ensure connect to folder in USBMS ends with a trailing separator Some third party plugins apparently do string concatenation on paths instead of using os.path.join --- src/calibre/devices/usbms/device.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index a7d3c3811a..43df29f241 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -763,6 +763,8 @@ class Device(DeviceConfig, DevicePlugin): raise DeviceError(f'The path {folder_path} is not a folder cannot connect to it') if not os.access(folder_path, os.R_OK | os.W_OK): raise DeviceError(f'You do not have permission to read and write to {folder_path} cannot connect to it') + if not folder_path.endswith(os.sep) and not folder_path.endswith('/'): + folder_path += os.sep self._main_prefix = folder_path self.current_library_uuid = library_uuid self.device_being_opened = connected_device