From 0bb915474785ccdfd9d559140652b996d88a908d Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 26 Sep 2021 03:56:30 +0200 Subject: [PATCH] catch more tagparser panics --- copyparty/up2k.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 5b5181da..cf1590d4 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -940,7 +940,12 @@ class Up2k(object): def _tag_file(self, write_cur, entags, wark, abspath, tags=None): if tags is None: - tags = self.mtag.get(abspath) + try: + tags = self.mtag.get(abspath) + except Exception as ex: + msg = "failed to read tags from {}:\n{}" + self.log(msg.format(abspath, ex), c=3) + return if entags: tags = {k: v for k, v in tags.items() if k in entags} @@ -1880,11 +1885,16 @@ class Up2k(object): # self.log("\n " + repr([ptop, rd, fn])) abspath = os.path.join(ptop, rd, fn) - tags = self.mtag.get(abspath) - ntags1 = len(tags) - parsers = self._get_parsers(ptop, tags, abspath) - if parsers: - tags.update(self.mtag.get_bin(parsers, abspath)) + try: + tags = self.mtag.get(abspath) + ntags1 = len(tags) + parsers = self._get_parsers(ptop, tags, abspath) + if parsers: + tags.update(self.mtag.get_bin(parsers, abspath)) + except Exception as ex: + msg = "failed to read tags from {}:\n{}" + self.log(msg.format(abspath, ex), c=3) + continue with self.mutex: cur = self.cur[ptop]