From 771d37b3c194c28eee3146a1f793bca8b22da5e9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Dec 2022 19:27:02 +0530 Subject: [PATCH] Fix #2000582 [When converting to newer file format version, original file is shown without a format icon.](https://bugs.launchpad.net/calibre/+bug/2000582) --- src/calibre/gui2/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 480b9e9581..a67dc74680 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -815,9 +815,12 @@ class FileIconProvider(QFileIconProvider): def key_from_ext(self, ext): key = ext if ext in self.icons else 'default' - if key == 'default' and ext.count('.') > 0: + if key == 'default' and '.' in ext: ext = ext.rpartition('.')[2] key = ext if ext in self.icons else 'default' + if key == 'default' and ext.startswith('original_'): + ext = ext.partition('_')[2] + key = ext if ext in self.icons else 'default' if key == 'default': key = ext return key