Skip to content

Generated directory paths can still have colons #368

Description

@nickzuber

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:

@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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions