utils.py: Fix not adding files correctly in some edge cases

This commit is contained in:
Fabian Würfl 2018-05-30 19:14:32 +02:00
parent 5619f5cb78
commit 32c78544f9

View File

@ -9,7 +9,7 @@ import zipfile
def get_recursive_filelist_sorted(path): def get_recursive_filelist_sorted(path):
filelist = [] filelist = []
for root, dirs, files in os.walk(path): for root, dirs, files in os.walk(path):
relroot = root.replace(path, '') relroot = root.replace(path, '', 1)
if relroot != '' and relroot in var.config.get('bot', 'ignored_folders'): if relroot != '' and relroot in var.config.get('bot', 'ignored_folders'):
continue continue
if len(relroot): if len(relroot):
@ -66,7 +66,7 @@ class Dir(object):
def add_file(self, file): def add_file(self, file):
if file.startswith(self.name + '/'): if file.startswith(self.name + '/'):
file = file.replace(self.name + '/', '') file = file.replace(self.name + '/', '', 1)
if '/' in file: if '/' in file:
# This file is in a subdir # This file is in a subdir