|
|
@ -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)
|
|
|
|