From 6f405e69762dcb9c54c06fdd381116c5908a97ef Mon Sep 17 00:00:00 2001 From: Evans Jahja <1199566+EvansJahja@users.noreply.github.com> Date: Wed, 20 Mar 2024 20:29:56 +0900 Subject: [PATCH] (Nsps) check fileSize against 0 or None Sometimes, files.json can contain 0 in the file size. This is especially true when new files are added as NUT is running. --- nut/Nsps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nut/Nsps.py b/nut/Nsps.py index 830f52de8..ec5905372 100644 --- a/nut/Nsps.py +++ b/nut/Nsps.py @@ -164,7 +164,7 @@ def _load_nsp_filesize(json_title, nsp): if 'fileSize' in json_title: nsp.fileSize = json_title['fileSize'] - if nsp.fileSize is None: + if nsp.fileSize is None or nsp.fileSize == 0: _path = json_title['path'] Print.warning(f"Missing file size for `{_path}`. Trying to get size again...") _file_size = nsp.getFileSize()