aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantиn Ryabitsev <konstantin@linuxfoundation.org>2022-11-22 15:57:39 -0500
committerKonstantиn Ryabitsev <konstantin@linuxfoundation.org>2022-11-22 15:57:39 -0500
commitd416f2e37ef3164de0a14df4af5381e06553847c (patch)
treece26a29ef259ba9a2877b8c011b57b5a2a517fe9
parent6d3604b55eac93ed6432ca7df5d66f728b7e5a5e (diff)
downloadb4-d416f2e37ef3164de0a14df4af5381e06553847c.tar.gz
Don't convert to bytes for verification payload
I'm not sure why I was encoding into bytes here, as it's not necessary at all. This additionally uncovered an annoying gotcha: auth_verify will crash when the simplejson library is not available, because in that case the requests library will use python's standard json, which does not accept bytes as dict values. Since simplejson merely decodes all bytes back into unicode strings, just removing the encode() call here should be enough to work with both backend libraries without any changes required on the API end. Reported-by: Noralf Trønnes <noralf@tronnes.org> Link: https://msgid.link/4161738f-e2df-2d8e-7646-2c61df2f76b9@tronnes.org Signed-off-by: Konstantиn Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ez.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/b4/ez.py b/b4/ez.py
index 6c607cc..c529ca1 100644
--- a/b4/ez.py
+++ b/b4/ez.py
@@ -183,7 +183,7 @@ def auth_verify(cmdargs: argparse.Namespace) -> None:
req = {
'action': 'auth-verify',
- 'msg': bdata.encode(),
+ 'msg': bdata,
}
logger.info('Submitting verification to %s', endpoint)
ses = b4.get_requests_session()