adjust filter_path: also remove trailing os.sep
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 17 Jun 2016 13:28:34 +0000 (15:28 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 17 Jun 2016 14:16:03 +0000 (16:16 +0200)
deltatar/deltatar.py

index b258690..79a24ea 100644 (file)
@@ -278,7 +278,10 @@ class DeltaTar(object):
         2. excluded_files
         3. filter_func (which must return whether the file is accepted or not)
         '''
+
         if len(source_path) > 0:
+            # ensure that exactly one '/' at end of dir is also removed
+            source_path = source_path.rstrip(os.sep) + os.sep
             path = path[len(source_path):]
 
         # 1. filter included_files
@@ -1275,7 +1278,7 @@ class DeltaTar(object):
                 op_type = ipath['type']
 
             # filter paths
-            if self.filter_path(upath, '.', op_type == 'directory') == NO_MATCH:
+            if self.filter_path(upath, '', op_type == 'directory') == NO_MATCH:
                 continue
 
             # if types of the file mismatch, the file needs to be deleted