@@ -93,6 +93,19 @@ def _normalize_algo(algo):
9393 return 'auto'
9494 return a
9595
96+ def _normalize_ver_digits (ver_text ):
97+ """
98+ Make the on-disk version match Archive's strict header check:
99+ - remove dots
100+ - strip leading zeros by int() cast when numeric
101+ Falls back to the raw digits if not purely numeric.
102+ """
103+ raw = ver_text .replace ("." , "" )
104+ try :
105+ return str (int (raw )) # "001" -> "1"
106+ except ValueError :
107+ return raw # keep as-is if not numeric
108+
96109def _compress_bytes (data , algo = 'none' , level = None ):
97110 """Return (stored_bytes, used_algo)."""
98111 algo = _normalize_algo (algo )
@@ -440,7 +453,7 @@ def _get(name, default=None):
440453 ext = _get ('extension' , '.neo' )
441454
442455 delim_real = _decode_delim_escape (delim )
443- ver_digits = _ver_digits (ver )
456+ ver_digits = _normalize_ver_digits ( _ver_digits (ver ) )
444457
445458 spec = {
446459 'format_magic' : magic ,
@@ -511,7 +524,7 @@ def _checksum(data, cstype, text=False):
511524def _write_global_header (fp , numfiles , encoding , checksumtype , extradata , formatspecs ):
512525 delim = formatspecs ['format_delimiter' ]
513526 magic = formatspecs ['format_magic' ]
514- ver_digits = _ver_digits (formatspecs .get ('format_ver' ,'001' ))
527+ ver_digits = _normalize_ver_digits ( _ver_digits (formatspecs .get ('format_ver' ,'001' ) ))
515528
516529 # extras blob: count + items
517530 if isinstance (extradata , dict ) and extradata :
0 commit comments