Skip to content

Commit

Permalink
Fix read receipts and redactions on v3 rooms
Browse files Browse the repository at this point in the history
Previously slashes in eventIds (that come plenty in v3 due to base64 encoding) were not properly encoded - they are now.
  • Loading branch information
KitsuneRal committed Mar 13, 2019
1 parent 8c685b4 commit f13d54b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/jobs/basejob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ QUrl BaseJob::makeRequestUrl(QUrl baseUrl,
if (!pathBase.endsWith('/') && !path.startsWith('/'))
pathBase.push_back('/');

baseUrl.setPath( pathBase + path );
baseUrl.setPath(pathBase + path, QUrl::TolerantMode);
baseUrl.setQuery(query);
return baseUrl;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/room.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ Room::Changes Room::Private::markMessagesAsRead(rev_iter_t upToMarker)
{
if ((*upToMarker)->senderId() != q->localUser()->id())
{
connection->callApi<PostReceiptJob>(id, "m.read",
(*upToMarker)->id());
connection->callApi<PostReceiptJob>(id, QStringLiteral("m.read"),
QUrl::toPercentEncoding((*upToMarker)->id()));
break;
}
}
Expand Down Expand Up @@ -1734,8 +1734,8 @@ void Room::unban(const QString& userId)

void Room::redactEvent(const QString& eventId, const QString& reason)
{
connection()->callApi<RedactEventJob>(
id(), eventId, connection()->generateTxnId(), reason);
connection()->callApi<RedactEventJob>(id(),
QUrl::toPercentEncoding(eventId), connection()->generateTxnId(), reason);
}

void Room::uploadFile(const QString& id, const QUrl& localFilename,
Expand Down

0 comments on commit f13d54b

Please sign in to comment.