From 7efdcdcdbe63ec166ca5d9b91e665809a7040ff5 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 16 Sep 2021 20:50:31 -0700 Subject: [PATCH] Fix handling of basename=None. --- rarpar.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rarpar.py b/rarpar.py index 189b0c9..ced194a 100644 --- a/rarpar.py +++ b/rarpar.py @@ -376,7 +376,9 @@ def rarpar( date = time.strftime('%Y-%m-%d') timestamp = time.strftime('%Y-%m-%d_%H-%M-%S') - basename = re.sub(r'\.rar$', '', basename) + if basename is not None: + basename = re.sub(r'\.rar$', '', basename) + if not basename: basename = f'{path.basename} ({timestamp})' else: