Generated directory paths can still have colons

Open
#368 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Start at _generate_path_from_repo_url and reproduce the git@git.dev.box.net:Productivity/ClusterRunnerHealthCheck.git example on a Windows-compatible path. Trace how the parsed URL parts form repo_directory and repo_name, then verify that the resulting generated directory path contains no illegal colons.

Written by the indexing model from the issue text.

Description

bug minor

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
Dominant language
Python
Stars
184
Forks
41
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from box/ClusterRunner

All issues in box/ClusterRunner

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.