From f49c5364cd3319ced2e503e5b6a5c9cd140d9e06 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Thu, 21 Jul 2022 10:22:17 +0200 Subject: [PATCH] fix bug #21 on Windows --- catcli/noder.py | 3 ++- catcli/utils.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/catcli/noder.py b/catcli/noder.py index 701bd2d..e4b42a0 100644 --- a/catcli/noder.py +++ b/catcli/noder.py @@ -319,7 +319,8 @@ class Noder: out.append(utils.human(node.size)) # size out.append(utils.epoch_to_str(storage.ts)) # indexed_at - out.append(utils.epoch_to_str(node.maccess)) # maccess + if self._has_attr(node, 'maccess'): + out.append(utils.epoch_to_str(node.maccess)) # maccess if node.md5: out.append(node.md5) # md5 else: diff --git a/catcli/utils.py b/catcli/utils.py index 798e784..aa41421 100644 --- a/catcli/utils.py +++ b/catcli/utils.py @@ -52,6 +52,8 @@ def human(size): def epoch_to_str(epoch): '''convert epoch to string''' + if not epoch: + return '' fmt = '%Y-%m-%d %H:%M:%S' t = datetime.datetime.fromtimestamp(float(epoch)) return t.strftime(fmt)