diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-10 22:38:10 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-10 22:44:06 +0200 |
commit | 2bf18a64d236c2364e12d4c2f1a9464cc6a2ebf9 (patch) | |
tree | 25dfe59097bc284891231263e992cbffbce3661d /lib/room.cpp | |
parent | df46414a4e16d608049610935aeabab222e06d72 (diff) | |
download | libquotient-2bf18a64d236c2364e12d4c2f1a9464cc6a2ebf9.tar.gz libquotient-2bf18a64d236c2364e12d4c2f1a9464cc6a2ebf9.zip |
Move URL creation to Room/Connection; use query instead of fragment
The query is easier to manipulate; and the original mxc URL is not used
for the real network request anyway.
Diffstat (limited to 'lib/room.cpp')
-rw-r--r-- | lib/room.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 890da13d..72b37f62 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1116,6 +1116,17 @@ QList<User*> Room::directChatUsers() const return connection()->directChatUsers(this); } +QUrl Room::makeMediaUrl(const QString& eventId, const QUrl& mxcUrl) const +{ + auto url = connection()->makeMediaUrl(mxcUrl); + QUrlQuery q(url.query()); + Q_ASSERT(q.hasQueryItem("user_id")); + q.addQueryItem("room_id", id()); + q.addQueryItem("event_id", eventId); + url.setQuery(q); + return url; +} + QString safeFileName(QString rawName) { return rawName.replace(QRegularExpression("[/\\<>|\"*?:]"), "_"); |