From b3663075a0821f27c95e652ca691304abfc89f5a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 6 Apr 2020 20:13:18 -0700 Subject: [PATCH] notification: Expand and clarify restriction on id property - This is to allow arbitrary strings to be part of id property via base32 encoding. Signed-off-by: Sunil Mohan Adapa --- plinth/notification.py | 5 ++++- plinth/urls.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plinth/notification.py b/plinth/notification.py index 89140b86e..26c9c5858 100644 --- a/plinth/notification.py +++ b/plinth/notification.py @@ -70,7 +70,9 @@ class Notification(models.StoredNotification): following fields are present in the model: 'id' is a unique string identifier for the notification and acts as the - primary key for the stored database table. + primary key for the stored database table. Only the following chars are + currently allowed: A-Z, a-z, 0-9, - and =. If other chars must be used, it + is recommended to use base32 encoding. 'app_id' is the unique ID of the app showing the notification. @@ -154,6 +156,7 @@ class Notification(models.StoredNotification): been dismissed by the user. """ + class Meta: # pylint: disable=too-few-public-methods """Meta properties of the Notification model.""" proxy = True diff --git a/plinth/urls.py b/plinth/urls.py index 8d69881ed..5317ef32c 100644 --- a/plinth/urls.py +++ b/plinth/urls.py @@ -32,6 +32,6 @@ urlpatterns = [ url(r'locked/$', public(CaptchaLoginView.as_view()), name='locked_out'), # Notifications - url(r'^notification/(?P[a-z0-9-]+)/dismiss/$', + url(r'^notification/(?P[A-Za-z0-9-=]+)/dismiss/$', views.notification_dismiss, name='notification_dismiss') ]