Skip to content

Commit

Permalink
Fixed the second half of the Android Uri encoding too
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Feb 19, 2024
1 parent 275747c commit 47d05d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/platform/AndroidHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ QString to_document_uri(const QString& path)
const QString rel_dir = prefix + storage_root.relativeFilePath(abs_dir);
const QString rel_path = prefix + storage_root.relativeFilePath(abs_path);

const auto uri_encode = [](const QString& path) {
return QUrl::toPercentEncoding(path, "_-!.~'()*");
};
const QString uri_str = QStringLiteral("content://com.android.externalstorage.documents/tree/%1/document/%2")
.arg(QUrl::toPercentEncoding(rel_dir, "_-!.~'()*"), QUrl::toPercentEncoding(rel_path));
.arg(uri_encode(rel_dir), uri_encode(rel_path));

return uri_str;
}
Expand Down

0 comments on commit 47d05d3

Please sign in to comment.