changeset 6825:b04e44db7d8d

Modify unique token to use url safe characters. Looks like the merge of the methods I chose cause url unsafe / to be emitted sometimes. This causes poe post to fail as the url includes the key and the / messes up the rest route url parsing code.
author John Rouillard <rouilj@ieee.org>
date Sun, 07 Aug 2022 03:33:35 -0400
parents 9811073b289e
children 28b906a237d8
files roundup/backends/sessions_common.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/sessions_common.py	Sun Aug 07 02:45:08 2022 -0400
+++ b/roundup/backends/sessions_common.py	Sun Aug 07 03:33:35 2022 -0400
@@ -41,10 +41,10 @@
         return self.__logger
 
     def getUniqueKey(self, length=40):
-        otk = b2s(base64.b64encode(
+        otk = b2s(base64.urlsafe_b64encode(
             random_.token_bytes(length))).rstrip('=')
         while self.exists(otk):
-            otk = b2s(base64.b64encode(
+            otk = b2s(base64.urlsafe_b64encode(
                 random_.token_bytes(length))).rstrip('=')
 
         return otk

Roundup Issue Tracker: http://roundup-tracker.org/