vcl/qt5/QtTransferable.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit 9c855f5e596bf97cb1db6de3cc3d8f3785ec096b Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Fri Jan 3 10:03:01 2025 +0100 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Fri Jan 3 13:12:21 2025 +0100 Filter out text/uri-list with empty list ...as seen at least with the Qt6 Wasm implementation (see the code comment for details), and where, at least when trying to paste some plain text into Writer, the LO code would then favor that faux text/uri-list over text/plain, and would get into the > else if( bMsg ) branch in SwTransferable::PasteFileList (sw/source/uibase/dochdl/swdtflvr.cxx) and try to synchronously show a message box, which for now causes an abort in the Emscripten build Change-Id: I64e7cf66717f29b3609c04aea3c6124279ab55de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179699 Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 16f24763cf6e..266e9b49c341 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -75,6 +75,19 @@ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL QtTransferable::getTr if (rMimeType == QStringLiteral("text/plain;charset=unicode")) continue; + // At least the Qt6 Wasm implementation may announce text/uri-list even though the actual + // list of URLs is empty (presumably since + // <https://github.com/qt/qtbase/commit/0ffe8050bd5b55d64da37f5177a7e20dd9d14232> "wasm: + // implement async drag-and-drop" unconditionally calls setUrls in + // DataTransfer::toMimeDataWithFile's MimeContext::deref): + if (rMimeType == QStringLiteral("text/uri-list")) + { + if (m_pMimeData->urls().empty()) + { + continue; + } + } + // LO doesn't like 'text/plain', so we have to provide UTF-16 bool bIsNoCharset = false, bIsUTF16 = false, bIsUTF8 = false; if (lcl_textMimeInfo(toOUString(rMimeType), bIsNoCharset, bIsUTF16, bIsUTF8))