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