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 d89c32140a.

Change-Id: I8107c7d482dee75f4637e13400b8844b3d3ff804
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
bb10
Assam Boudjelthia 2024-03-22 01:16:33 +02:00
parent 34b15dcc8a
commit 619570f23d
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}