summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-04-29 13:12:09 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-04-29 13:12:09 +0200
commit620b6e8838a8486d2a30c5e0dc3a774a882cbe37 (patch)
tree69429534179675743ac6113587f8e243a2a7cb63 /src
parentMake pagination logic slightly more robust (diff)
downloadnheko-620b6e8838a8486d2a30c5e0dc3a774a882cbe37.tar.xz
Fix some encoding issues when translating matrix.to to matrix:
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineViewManager.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 33af1825..648b499d 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -454,20 +454,18 @@ TimelineViewManager::openLink(QString link) const
         QUrl url(link);
         if (url.scheme() == "https" && url.host() == "matrix.to") {
                 // handle matrix.to links internally
-                QString p = url.fragment(QUrl::FullyDecoded);
+                QString p = url.fragment(QUrl::FullyEncoded);
                 if (p.startsWith("/"))
                         p.remove(0, 1);
 
                 auto temp = p.split("?");
                 QString query;
                 if (temp.size() >= 2)
-                        query = temp.takeAt(1);
+                        query = QUrl::fromPercentEncoding(temp.takeAt(1).toUtf8());
 
                 temp            = temp.first().split("/");
-                auto identifier = temp.first();
-                QString eventId;
-                if (temp.size() >= 2)
-                        eventId = temp.takeAt(1);
+                auto identifier = QUrl::fromPercentEncoding(temp.takeFirst().toUtf8());
+                QString eventId = QUrl::fromPercentEncoding(temp.join('/').toUtf8());
                 if (!identifier.isEmpty()) {
                         if (identifier.startsWith("@")) {
                                 QByteArray uri =