From f38cc3125f22f2dba84ae49b83aad624f3756899 Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Fri, 5 Jan 2024 16:38:04 +0100 Subject: [PATCH] do not open zip files in binary --- cat_win/cat.py | 5 +++-- cat_win/util/{ => specific_formats}/zipviewer.py | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename cat_win/util/{ => specific_formats}/zipviewer.py (100%) diff --git a/cat_win/cat.py b/cat_win/cat.py index 4c118a9b..7ed11c07 100644 --- a/cat_win/cat.py +++ b/cat_win/cat.py @@ -47,7 +47,7 @@ from cat_win.util.utility import comp_eval, comp_conv, split_replace except SyntaxError: # in case of Python 3.7 from cat_win.util.utilityold import comp_eval, comp_conv, split_replace -from cat_win.util.zipviewer import display_zip +from cat_win.util.specific_formats.zipviewer import display_zip from cat_win.util import stdinhelper from cat_win.web.updatechecker import print_update_information from cat_win import __project__, __version__, __sysversion__, __author__, __url__ @@ -771,7 +771,8 @@ def edit_file(file_index: int = 0) -> None: holder.files[file_index].set_plaintext(plain=False) if holder.args_id[ARGS_PLAIN_ONLY]: return - display_zip(holder.files[file_index].path, _convert_size) + if display_zip(holder.files[file_index].path, _convert_size): + return err_print('Failed to open:', holder.files[file_index].displayname) try: enter_char = '⏎' diff --git a/cat_win/util/zipviewer.py b/cat_win/util/specific_formats/zipviewer.py similarity index 100% rename from cat_win/util/zipviewer.py rename to cat_win/util/specific_formats/zipviewer.py