Remove trailing spaces in folder names

master
Dan Howe 6 years ago
parent 3740e79fc4
commit e916ccea92

@ -25,8 +25,11 @@ from requests.exceptions import ConnectionError, InvalidURL
def make_safe(s): def make_safe(s):
"""Remove characters that would be invalid in a filepath""" """Remove characters that would be invalid in a filepath"""
# Remove trailing spaces
s_safe = s.strip()
# Remove '\', '*', '"', '<', '>' '|' # Remove '\', '*', '"', '<', '>' '|'
s_safe = re.sub('\\\|\*|"|<|>\|', '', s) s_safe = re.sub('\\\|\*|"|<|>\|', '', s_safe)
# Replace '/' and ':' with '-' # Replace '/' and ':' with '-'
s_safe = re.sub(':', ' -', s_safe) s_safe = re.sub(':', ' -', s_safe)

Loading…
Cancel
Save