box / box/ClusterRunner

Generated directory paths can still have colons

Open
#368 2 comments 0 reactions 0 assignees View on GitHub
bug minor
Dominant language
Python
Stars
184
Forks
41
PR merge metrics
No merged PRs in 30d

Description

I noticed in `_generate_path_from_repo_url` we remove the colons from the `netloc`, however we don't try to remove colons anywhere else like from `path`, which makes something like

```
urlparse('git@git.dev.box.net:Productivity/ClusterRunnerHealthCheck.git')
# ParseResult(scheme='', netloc='', path='git@git.dev.box.net:Productivity/ClusterRunnerHealthCheck.git', params='', query='', fragment='')
```

create a repo directory like

```
~/.clusterrunner/repos/master/git@git.dev.box.net:Productivity/ClusterRunnerHealthCheck
````

Since Windows doesn't like colons in directory paths, we could just do all the illegal character removing at the end instead of trying to hit each piece as we create the path.

Something like:

```python
@staticmethod
def _generate_path_from_repo_url(base_sys_path, url):
# ...
return Git._clean_path_url(os.path.join(repo_directory, repo_name))

@staticmethod
def _clean_path_url(url):
illegal_chars = [':', '-'] # any characters that we don't want in a directory path
clean_url = ''.join(c for c in url if c not in illegal_chars)
return clean_url
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.