Skip to content

Commit

Permalink
makeMediaUrl(): overwrite existing query items
Browse files Browse the repository at this point in the history
...instead of just appending key-value pairs.

(cherry picked from commit e7fe0b9)
  • Loading branch information
KitsuneRal committed Jan 24, 2025
1 parent 4a0edac commit 0fca50c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ QUrl Connection::makeMediaUrl(QUrl mxcUrl) const
{
Q_ASSERT(mxcUrl.scheme() == "mxc"_L1);
QUrlQuery q(mxcUrl.query());
q.removeAllQueryItems(u"user_id"_s);
q.addQueryItem(u"user_id"_s, userId());
mxcUrl.setQuery(q);
return mxcUrl;
Expand Down
6 changes: 4 additions & 2 deletions Quotient/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,10 @@ 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"_L1));
q.addQueryItem("room_id"_L1, id());
q.addQueryItem("event_id"_L1, eventId);
q.removeAllQueryItems(u"room_id"_s);
q.addQueryItem(u"room_id"_s, id());
q.removeAllQueryItems(u"event_id"_s);
q.addQueryItem(u"event_id"_s, eventId);
url.setQuery(q);
return url;
}
Expand Down

0 comments on commit 0fca50c

Please sign in to comment.