Android: fix content url handling of filenames with spaces

The Android APIs expect the content url filenames to have
percent encoded spaces, so handle that internally, if missing,
under the content file engine.

Fixes: QTBUG-112663
Pick-to: 6.5 6.2 5.15
Change-Id: Ieb2ee41a2587f985b589ca54b88f1cff89992154
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2023-05-03 16:53:19 +03:00
parent b6d5d419cc
commit ac8a39c416

View File

@ -593,10 +593,14 @@ DocumentFile::DocumentFile(const QJniObject &uri,
QJniObject parseUri(const QString &uri)
{
QString uriToParse = uri;
if (uriToParse.contains(' '))
uriToParse.replace(' ', QUrl::toPercentEncoding(" "));
return QJniObject::callStaticMethod<QtJniTypes::UriType>(
QtJniTypes::className<QtJniTypes::Uri>(),
"parse",
QJniObject::fromString(uri).object<jstring>());
QJniObject::fromString(uriToParse).object<jstring>());
}
DocumentFilePtr DocumentFile::parseFromAnyUri(const QString &fileName)