From: Christian Herdtweck Date: Fri, 17 Jun 2016 13:28:34 +0000 (+0200) Subject: adjust filter_path: also remove trailing os.sep X-Git-Tag: v2.2~27 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=75059f3ced36b5a496702fc02d44d42ad433d534;p=python-delta-tar adjust filter_path: also remove trailing os.sep --- diff --git a/deltatar/deltatar.py b/deltatar/deltatar.py index b258690..79a24ea 100644 --- a/deltatar/deltatar.py +++ b/deltatar/deltatar.py @@ -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