Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨No invalid characters in new project directory name #278

Merged
merged 8 commits into from
Apr 17, 2023
4 changes: 4 additions & 0 deletions pros/conductor/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ def remove_template(project: Project, identifier: Union[str, BaseTemplate], remo
def new_project(self, path: str, no_default_libs: bool = False, **kwargs) -> Project:
if Path(path).exists() and Path(path).samefile(os.path.expanduser('~')):
raise dont_send(ValueError('Will not create a project in user home directory'))
for char in str(Path(path)):
if char in ['/', '?', '<', '>', '\\', ':', '*', '|', '^', '#', '%', '&', '$', '+', '!', '`', '\'', '=',
'@', '\'', '{', '}', '[', ']', '(', ')', '~'] or ord(char) > 127:
raise dont_send(ValueError(f'Invalid character found in directory name: \'{char}\''))
proj = Project(path=path, create=True)
if 'target' in kwargs:
proj.target = kwargs['target']
Expand Down