From 247c93ca48fdbecf13ba105a47ea80398eea550d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 13 Dec 2021 12:47:30 +0100 Subject: [PATCH] stack: strip trailing dots from short_name Fixes assertion failure which can occur because the short_name is a truncated version of the already-sanitized long_name, but the truncation may leave a trailing dot. --- stgit/lib/stack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py index db562827..77af98ce 100644 --- a/stgit/lib/stack.py +++ b/stgit/lib/stack.py @@ -213,6 +213,9 @@ def make_name(self, raw, unique=True, lower=True, allow=(), disallow=()): short_name = new_name else: break + # Strip trailing dots again because the truncation may have + # left a trailing dot, which is not allowed + short_name = re.sub(r'\.+$', '', short_name) assert self.is_name_valid(short_name) if not unique: