utils: Fix when a filename has no extension
patch c5d6314d751bbaca2ba4d24f4af0465af751ac40
Author: E. Bosch <presidev@AT@gmail.com>
Date: Sun Apr 28 00:28:22 CEST 2024
* utils: Fix when a filename has no extension
diff -rN -u old-irgramd/utils.py new-irgramd/utils.py
--- old-irgramd/utils.py 2024-11-22 10:03:53.880752630 +0100
+++ new-irgramd/utils.py 2024-11-22 10:03:53.880752630 +0100
@@ -2,7 +2,7 @@
# utils.py: Helper functions
#
# Copyright (c) 2019 Peter Bui <pbui@bx612.space>
-# Copyright (c) 2020-2023 E. Bosch <presidev@AT@gmail.com>
+# Copyright (c) 2020-2024 E. Bosch <presidev@AT@gmail.com>
#
# Use of this source code is governed by a MIT style license that
# can be found in the LICENSE file included in this project.
@@ -93,7 +93,10 @@
if add:
aux = filename.rsplit('.', 1)
name = aux[0]
- ext = aux[1]
+ try:
+ ext = aux[1]
+ except:
+ ext = ''
return '{}-{}.{}'.format(name, add, ext)
else:
return filename