From 53faf44a0370cada18e8fbb337bbd671e50c680b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 2 Apr 2025 11:14:19 +0530 Subject: [PATCH] macOS: Fix opening book folder or PDF files for books with square brackets in the title not working. Fixes #2105884 [(MacOS) Can't open PDFs or "open book folder" if Title contains "[" or "]"](https://bugs.launchpad.net/calibre/+bug/2105884) I have patched the Qt bundled with calibre with the upstream fix for https://bugreports.qt.io/browse/QTBUG-134073 --- src/calibre/gui2/dnd.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/calibre/gui2/dnd.py b/src/calibre/gui2/dnd.py index 5b7c5e509c..c203d30962 100644 --- a/src/calibre/gui2/dnd.py +++ b/src/calibre/gui2/dnd.py @@ -14,7 +14,7 @@ from threading import Thread from qt.core import QDialog, QDialogButtonBox, QImageReader, QLabel, QMimeData, QPixmap, QProgressBar, Qt, QTimer, QUrl, QVBoxLayout from calibre import as_unicode, browser, prints -from calibre.constants import DEBUG, ismacos, iswindows +from calibre.constants import DEBUG, iswindows from calibre.gui2 import error_dialog from calibre.ptempfile import PersistentTemporaryFile from calibre.utils.filenames import make_long_path_useable @@ -390,9 +390,4 @@ def has_firefox_ext(md, exts): def set_urls_from_local_file_paths(md: QMimeData, *paths: str) -> QMimeData: md.setUrls(list(map(QUrl.fromLocalFile, paths))) - if ismacos: - # see https://bugreports.qt.io/browse/QTBUG-134073 - raw = bytes(md.data('text/uri-list')) - raw = raw.replace(b'[', b'%5B').replace(b']', b'%5D') - md.setData('text/uri-list', raw) return md