From 31211945d9c10df4c7d5a6002f7f1d3439f43f74 Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Sat, 16 Mar 2024 15:20:09 -0500 Subject: [PATCH] Fix a couple issues with CBZ files (#1529) * Set cbz resolution to None, None when it can't be determined * Don't consider the `__MACOSX` directory for cbz --- hydrus/core/files/HydrusArchiveHandling.py | 8 ++++++++ hydrus/core/files/HydrusFileHandling.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hydrus/core/files/HydrusArchiveHandling.py b/hydrus/core/files/HydrusArchiveHandling.py index cdc04b57..e2a0f595 100644 --- a/hydrus/core/files/HydrusArchiveHandling.py +++ b/hydrus/core/files/HydrusArchiveHandling.py @@ -45,6 +45,10 @@ def GetCoverPagePath( zip_handle: zipfile.ZipFile ): for path in all_file_paths: + if path.startswith('__MACOSX/'): + + continue + if '.' in path: ext_with_dot = '.' + path.split( '.' )[-1] @@ -161,6 +165,10 @@ def ZipLooksLikeCBZ( path_to_zip ): filename = zip_info.filename + if filename.startswith('__MACOSX/'): + + continue + if '/' in filename: directory_path = '/'.join( filename.split( '/' )[:-1] ) diff --git a/hydrus/core/files/HydrusFileHandling.py b/hydrus/core/files/HydrusFileHandling.py index 0f612006..326da5c6 100644 --- a/hydrus/core/files/HydrusFileHandling.py +++ b/hydrus/core/files/HydrusFileHandling.py @@ -484,7 +484,7 @@ def GetFileInfo( path, mime = None, ok_to_look_for_hydrus_updates = False ): except: - ( width, height ) = ( 100, 100 ) + ( width, height ) = ( None, None ) finally: