diff options
Diffstat (limited to 'core/utils.py')
-rw-r--r-- | core/utils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/utils.py b/core/utils.py index 23d6a85..bfd6eee 100644 --- a/core/utils.py +++ b/core/utils.py @@ -212,11 +212,7 @@ def get_cookie(request): # NO_COOKIE_DEFAULT = 'Unset Cookie <hohlenforscher@potatohut.expo>' print(f"-- Getting cookie...") editor_id = request.COOKIES.get('editor_id', "") # if no cookie, then default string "" - if editor_id.startswith("Unset"): - # clean out laziness in users' PCs - editor_id = "" - else: - editor = git_string(editor_id) # belt and braces, should have been validity checked on saving already + editor = git_string(editor_id) # belt and braces, should have been validity checked on saving already print(f"-- Cookie to be used: {editor=}") return editor @@ -227,6 +223,10 @@ def git_string(author_string): """ author_regex = re.compile(r'^[a-zA-Z][\w\s\_\.\-]* <[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-_]+\.[a-zA-Z]{2,}>$') + if author_string.startswith("Unset"): + # clean out laziness in users' PCs + return "" + if author_regex.match(author_string): print(f"++ Is valid git-compatible author string: '{author_string}'") return author_string |