@@ -282,6 +282,10 @@ def get_default_threads():
282282 __use_http_lib__ = "httpx"
283283if ((__use_http_lib__ == "httpx" or __use_http_lib__ == "requests" ) and not havehttpx and not haverequests ):
284284 __use_http_lib__ = "urllib"
285+ # Define a function to check if var contains only non-printable chars
286+ all_np_chars = [chr (i ) for i in range (128 )]
287+ def is_only_nonprintable (var ):
288+ return all (not c .isprintable () for c in var )
285289__file_format_multi_dict__ = {}
286290__file_format_default__ = "ArchiveFile"
287291__include_defaults__ = True
@@ -305,7 +309,10 @@ def decode_unicode_escape(value):
305309 "newstyle" , "advancedlist" , "altinode"
306310 ]
307311 if all (key in config [section ] for key in required_keys ):
308- __file_format_multi_dict__ .update ( { decode_unicode_escape (config .get (section , 'magic' )): {'format_name' : decode_unicode_escape (config .get (section , 'name' )), 'format_magic' : decode_unicode_escape (config .get (section , 'magic' )), 'format_lower' : decode_unicode_escape (config .get (section , 'lower' )), 'format_len' : config .getint (section , 'len' ), 'format_hex' : config .get (section , 'hex' ), 'format_delimiter' : decode_unicode_escape (config .get (section , 'delimiter' )), 'format_ver' : config .get (section , 'ver' ), 'new_style' : config .getboolean (section , 'newstyle' ), 'use_advanced_list' : config .getboolean (section , 'advancedlist' ), 'use_alt_inode' : config .getboolean (section , 'altinode' ), 'format_extension' : decode_unicode_escape (config .get (section , 'extension' )) } } )
312+ delim = decode_unicode_escape (config .get (section , 'delimiter' ))
313+ if (not is_only_nonprintable (delim )):
314+ delim = "\x00 " * len ("\x00 " )
315+ __file_format_multi_dict__ .update ( { decode_unicode_escape (config .get (section , 'magic' )): {'format_name' : decode_unicode_escape (config .get (section , 'name' )), 'format_magic' : decode_unicode_escape (config .get (section , 'magic' )), 'format_lower' : decode_unicode_escape (config .get (section , 'lower' )), 'format_len' : config .getint (section , 'len' ), 'format_hex' : config .get (section , 'hex' ), 'format_delimiter' : delim , 'format_ver' : config .get (section , 'ver' ), 'new_style' : config .getboolean (section , 'newstyle' ), 'use_advanced_list' : config .getboolean (section , 'advancedlist' ), 'use_alt_inode' : config .getboolean (section , 'altinode' ), 'format_extension' : decode_unicode_escape (config .get (section , 'extension' )) } } )
309316 if not __file_format_multi_dict__ and not __include_defaults__ :
310317 __include_defaults__ = True
311318elif __use_ini_file__ and not os .path .exists (__config_file__ ):
0 commit comments