From 619570f23d488adb08a53894dc1bdc153880cc61 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 22 Mar 2024 01:16:33 +0200 Subject: [PATCH] Android: don't append slash for content paths under QAFE content URI obtain permissions when selected by the Android file provider, and the Android APIs will treat them as different URIs if a slash is added and thus such paths will be unaccessible the same way. Amends d89c32140a0f9b0bd5de113762c28d7861d4a928. Change-Id: I8107c7d482dee75f4637e13400b8844b3d3ff804 Reviewed-by: Ahmad Samir --- src/corelib/io/qabstractfileengine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qabstractfileengine.cpp b/src/corelib/io/qabstractfileengine.cpp index a8051f9687..46a7dd86b4 100644 --- a/src/corelib/io/qabstractfileengine.cpp +++ b/src/corelib/io/qabstractfileengine.cpp @@ -19,9 +19,15 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static QString appendSlashIfNeeded(const QString &path) { - if (!path.isEmpty() && !path.endsWith(u'/')) + if (!path.isEmpty() && !path.endsWith(u'/') +#ifdef Q_OS_ANDROID + && !path.startsWith("content:/"_L1) +#endif + ) return QString{path + u'/'}; return path; }