Fix #2000582 [When converting to newer file format version, original file is shown without a format icon.](https://bugs.launchpad.net/calibre/+bug/2000582)

This commit is contained in:
Kovid Goyal 2022-12-27 19:27:02 +05:30
parent 478f910611
commit 771d37b3c1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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