Fix regex string

This commit is contained in:
Albert Wang
2020-08-15 17:26:04 -07:00
parent fa27988c1c
commit 78cff47a91

View File

@@ -423,8 +423,8 @@ def get_github_repo_url(args, repository):
if repository.get('is_gist'): if repository.get('is_gist'):
if args.prefer_ssh: if args.prefer_ssh:
# The git_pull_url value is always https for gists, so we need to transform it to ssh form # The git_pull_url value is always https for gists, so we need to transform it to ssh form
repo_url = re.sub('^https?:\/\/(.+)\/(.+)\.git$', r'git@\1:\2.git', repository['git_pull_url']) repo_url = re.sub(r'^https?:\/\/(.+)\/(.+)\.git$', r'git@\1:\2.git', repository['git_pull_url'])
repo_url = re.sub('^git@gist\.', 'git@', repo_url) # strip gist subdomain for better hostkey compatibility repo_url = re.sub(r'^git@gist\.', 'git@', repo_url) # strip gist subdomain for better hostkey compatibility
else: else:
repo_url = repository['git_pull_url'] repo_url = repository['git_pull_url']
return repo_url return repo_url