Function to remove invalid characters from file path

This commit is contained in:
shortcutme 2017-10-04 13:25:07 +02:00
parent 5dbaf02e33
commit f7ce401564
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 3 additions and 0 deletions

View File

@ -488,6 +488,9 @@ class ContentManager(object):
else:
return re.match("^[a-z\[\]\(\) A-Z0-9_@=\.\+-/]+$", relative_path)
def sanitizePath(self, inner_path):
return re.sub("[^a-z\[\]\(\) A-Z0-9_@=\.\+-/]", "", inner_path)
# Hash files in directory
def hashFiles(self, dir_inner_path, ignore_pattern=None, optional_pattern=None):
files_node = {}