From 793f0fc4a773c5f266edcf64a32eaf74519c76ef Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 29 Mar 2026 07:41:32 +0200 Subject: [PATCH] sharing/token: add separator to avoid b64 padding instead of using replace --- radicale/sharing/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radicale/sharing/__init__.py b/radicale/sharing/__init__.py index 3ad3d35e..8dd10a0e 100644 --- a/radicale/sharing/__init__.py +++ b/radicale/sharing/__init__.py @@ -953,8 +953,8 @@ class BaseSharing: else: User = user - # v1: create uuid token with 2x 32 bytes = 256 bit with base64 encoding but replace '=' with '0' to avoid any additional encoding issues issues - token = "/.token/v1/" + str(base64.urlsafe_b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes), 'utf-8').replace('=', '0') + "/" + # v1: create uuid token with 2x 16 bytes + separator = 264 bit with base64 encoding resulting in 56 chars without '=' padding + token = "/.token/v1/" + str(base64.urlsafe_b64encode(uuid.uuid4().bytes + b"\0" + uuid.uuid4().bytes), 'utf-8') + "/" if logger.isEnabledFor(logging.DEBUG): logger.debug("TRACE/" + api_info + ": %r (Permissions=%r token=%r)", PathMapped, Permissions, token)