check for multi-volume compatibility of tar modes also if reading multi-volume-improvements
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 25 Jul 2016 09:54:36 +0000 (11:54 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 12 Nov 2021 12:32:59 +0000 (13:32 +0100)
for reading, there is no max_volume_size but a new_volume_handler given

deltatar/tarfile.py

index bddfbb7..b6192f0 100644 (file)
@@ -2206,9 +2206,9 @@ class TarFile(object):
             if comptype == 'gz' or comptype == 'bz2':
                 kwargs['compresslevel'] = compresslevel
 
-            if 'max_volume_size' in kwargs:
-                if comptype != 'tar' and filemode in 'wa' \
-                        and kwargs['max_volume_size']:
+            if 'max_volume_size' in kwargs or 'new_volume_handler' in kwargs:
+                if comptype != 'tar' and (kwargs['new_volume_handler'] or
+                                          kwargs['max_volume_size']):
                     import warnings
                     warnings.warn('Only the first volume will be compressed '
                                   'for modes with "w:"!')