From c6b037301d2de6b80711afba2ed62623cec7dff2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 31 Aug 2021 09:06:41 +0530 Subject: [PATCH] Windows: Fix drag and drop from winzip not working. Fixes #1942129 [Trying to drag and drop a file from winrar](https://bugs.launchpad.net/calibre/+bug/1942129) --- src/calibre/gui2/dnd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index 4e2e7235fe..50637d803d 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -14,6 +14,7 @@ from qt.core import ( QTimer, QUrl, QVBoxLayout ) from threading import Thread +from contextlib import suppress from calibre import as_unicode, browser, prints from calibre.constants import DEBUG, iswindows @@ -169,8 +170,9 @@ def path_from_qurl(qurl, allow_remote=False): if lf: if iswindows: from calibre_extensions.winutil import get_long_path_name - lf = get_long_path_name(lf) - lf = make_long_path_useable(lf) + with suppress(OSError): + lf = get_long_path_name(lf) + lf = make_long_path_useable(lf) return lf if not allow_remote: return ''