mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix some encoding issues when translating matrix.to to matrix:
This commit is contained in:
parent
dbf23fafbf
commit
620b6e8838
1 changed files with 4 additions and 6 deletions
|
@ -454,20 +454,18 @@ TimelineViewManager::openLink(QString link) const
|
||||||
QUrl url(link);
|
QUrl url(link);
|
||||||
if (url.scheme() == "https" && url.host() == "matrix.to") {
|
if (url.scheme() == "https" && url.host() == "matrix.to") {
|
||||||
// handle matrix.to links internally
|
// handle matrix.to links internally
|
||||||
QString p = url.fragment(QUrl::FullyDecoded);
|
QString p = url.fragment(QUrl::FullyEncoded);
|
||||||
if (p.startsWith("/"))
|
if (p.startsWith("/"))
|
||||||
p.remove(0, 1);
|
p.remove(0, 1);
|
||||||
|
|
||||||
auto temp = p.split("?");
|
auto temp = p.split("?");
|
||||||
QString query;
|
QString query;
|
||||||
if (temp.size() >= 2)
|
if (temp.size() >= 2)
|
||||||
query = temp.takeAt(1);
|
query = QUrl::fromPercentEncoding(temp.takeAt(1).toUtf8());
|
||||||
|
|
||||||
temp = temp.first().split("/");
|
temp = temp.first().split("/");
|
||||||
auto identifier = temp.first();
|
auto identifier = QUrl::fromPercentEncoding(temp.takeFirst().toUtf8());
|
||||||
QString eventId;
|
QString eventId = QUrl::fromPercentEncoding(temp.join('/').toUtf8());
|
||||||
if (temp.size() >= 2)
|
|
||||||
eventId = temp.takeAt(1);
|
|
||||||
if (!identifier.isEmpty()) {
|
if (!identifier.isEmpty()) {
|
||||||
if (identifier.startsWith("@")) {
|
if (identifier.startsWith("@")) {
|
||||||
QByteArray uri =
|
QByteArray uri =
|
||||||
|
|
Loading…
Reference in a new issue