From f31bc7240215f6a050ad07275b9ff8c7753316e9 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 9 Aug 2023 15:08:12 +0200 Subject: [PATCH] backend: more careful format_evr() Accept preferably integer or None epoch. --- backend/copr_backend/helpers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/copr_backend/helpers.py b/backend/copr_backend/helpers.py index f74f2aa4d..05348366d 100644 --- a/backend/copr_backend/helpers.py +++ b/backend/copr_backend/helpers.py @@ -634,11 +634,12 @@ def get_chroot_arch(chroot): def format_evr(epoch, version, release): """ - Return evr in format (epoch:)version-release + Return evr in format (epoch:)version-release. The argument 'epoch' should + be integer value or null (but we rather also consider "strings" values). """ - if epoch is not None and epoch.isdigit(): - return f"{epoch}:{version}-{release}" - + if epoch is not None: + if isinstance(epoch, int) or epoch.isdigit(): + return f"{epoch}:{version}-{release}" return f"{version}-{release}"