Skip to content

Commit

Permalink
stack: strip trailing dots from short_name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaxKellermann authored and jpgrayson committed Dec 13, 2021
1 parent 0d275a9 commit 247c93c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions stgit/lib/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 247c93c

Please sign in to comment.