Fix opening temporary content: URIs from application content providers

e5d591a0d09 focused on document or tree URIs you'd get from the file
dialog, but we can also get ones via Intents from application-specific
content providers (e.g. opening an attachment from an email client).
Those need to be handled like a single document here, parsing them
like a tree URI results in a bunch of Java exceptions down the line.

Change-Id: I19cb1075fd6a3ccad927543f8bc5a63566f4877e
Pick-to: 6.5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9d4a34bbbe7ec39ef594b07aae06fc1029cc6e3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 33b4c2d4af90d255b59ac79175c145f0e3299915)
This commit is contained in:
Volker Krause 2024-01-02 18:11:03 +01:00 committed by Qt Cherry-pick Bot
parent 634e0cd675
commit ec35827669

View File

@ -608,7 +608,7 @@ DocumentFilePtr DocumentFile::parseFromAnyUri(const QString &fileName)
const QString encodedUri = QUrl(fileName).toEncoded(); const QString encodedUri = QUrl(fileName).toEncoded();
const QJniObject uri = parseUri(encodedUri); const QJniObject uri = parseUri(encodedUri);
if (DocumentsContract::isDocumentUri(uri)) if (DocumentsContract::isDocumentUri(uri) || !DocumentsContract::isTreeUri(uri))
return fromSingleUri(uri); return fromSingleUri(uri);
const QString documentType = "/document/"_L1; const QString documentType = "/document/"_L1;