mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-28 11:25:37 +02:00

This allow to use xdg-open inside a snap Change-Id: I5ad7e067228b260174abf5c78d0a0e7c2cf8c31d
52 lines
2.3 KiB
Diff
52 lines
2.3 KiB
Diff
From f4410fcbb093f259eaff4a20fc4266a535479235 Mon Sep 17 00:00:00 2001
|
|
From: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
|
|
Date: Mon, 29 May 2023 13:09:53 -0400
|
|
Subject: [PATCH] OpenFile portal: do not use O_PATH fds
|
|
|
|
Using O_PATH requires correctly specifying whether the fd is writable or
|
|
not. Stating that the fd is writable without it actually being writable
|
|
results into rejection on xdg-desktop-portal side. Other implementations
|
|
like xdg-open or gtk have also moved away from O_PATH fds so this will
|
|
make a matching implementation and avoid possible rejections from xdp.
|
|
|
|
Fixes: QTBUG-113143
|
|
Original: https://codereview.qt-project.org/c/qt/qtbase/+/475425
|
|
---
|
|
qtbase/src/gui/platform/unix/qgenericunixservices.cpp | 8 ++------
|
|
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
|
index a0e5466c58..fe0fdaa625 100644
|
|
--- a/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
|
+++ b/qtbase/src/gui/platform/unix/qgenericunixservices.cpp
|
|
@@ -163,8 +163,7 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
|
// handle_token (s) - A string that will be used as the last element of the @handle.
|
|
// writable (b) - Whether to allow the chosen application to write to the file.
|
|
|
|
-#ifdef O_PATH
|
|
- const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_PATH);
|
|
+ const int fd = qt_safe_open(QFile::encodeName(url.toLocalFile()), O_RDONLY);
|
|
if (fd != -1) {
|
|
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.portal.Desktop"_L1,
|
|
"/org/freedesktop/portal/desktop"_L1,
|
|
@@ -174,16 +173,13 @@ static inline QDBusMessage xdgDesktopPortalOpenFile(const QUrl &url)
|
|
QDBusUnixFileDescriptor descriptor;
|
|
descriptor.giveFileDescriptor(fd);
|
|
|
|
- const QVariantMap options = {{"writable"_L1, true}};
|
|
+ const QVariantMap options = {};
|
|
|
|
// FIXME parent_window_id
|
|
message << QString() << QVariant::fromValue(descriptor) << options;
|
|
|
|
return QDBusConnection::sessionBus().call(message);
|
|
}
|
|
-#else
|
|
- Q_UNUSED(url);
|
|
-#endif
|
|
|
|
return QDBusMessage::createError(QDBusError::InternalError, qt_error_string());
|
|
}
|
|
--
|
|
2.40.1
|
|
|