diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-04 18:39:21 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-04 18:39:55 +0200 |
commit | 96f31d7d8ed1c9ab905c24ac039079aea622f4dc (patch) | |
tree | 06fea86951340d25a02cdd6f7eb89164be814bd9 /lib/csapi/directory.cpp | |
parent | 7c11f7fddbcc98e4b3b92060c475799d7518624c (diff) | |
download | libquotient-96f31d7d8ed1c9ab905c24ac039079aea622f4dc.tar.gz libquotient-96f31d7d8ed1c9ab905c24ac039079aea622f4dc.zip |
BaseJob: percent-encode variable path parts
This is meant to spare clients from having to percent-encode
room aliases, v3 event ids etc. that happen to hit the endpoint path.
It is unfair to expect clients to do that since they are not supposed
to care about the shape of CS API, which parameter should be encoded
in which way. The trick (together with the slightly updated GTAD
configuration) is to percent-encode parts that happen to be QStrings
and not `const char[]`'s while passing all constant parts as plain
C character literals. This also allows to make it more certain that
the path is correctly encoded by passing and storing QByteArray's
wherever the path is already encoded, and only use QStrings (next to
const char arrays) before that.
Since the change alters the API contract (even if that contract was
crappy), some crude detection of percent-encoded stuff on input is
inserted; if input is already percent-encoded, a warning is put to
the logs, alerting developers about the change.
Diffstat (limited to 'lib/csapi/directory.cpp')
0 files changed, 0 insertions, 0 deletions