Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:wufeifei/cobra
Browse files Browse the repository at this point in the history
  • Loading branch information
FeeiCN committed Aug 29, 2017
2 parents 0e7543e + 78eb6f0 commit e674eed
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cobra/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,15 @@ def post():
file_path = data.get('file_path')

if target.startswith('http'):
target = re.findall(r'(.*?\.git)', target)[0]
repo_user = target.split('/')[-2]
repo_name = target.split('/')[-1].replace('.git', '')
# repo_directory = os.path.join(os.path.join(os.path.join(code_path, 'git'), repo_user), repo_name)

split_target = target.split(':')
if len(split_target) == 3:
repo_name = split_target[1].split('/')[-1].replace('.git', '')
elif len(split_target) == 2:
repo_name = split_target[1].split('/')[-1].replace('.git', '')
else:
return {'code': 1002, 'msg': 'Invalid target.'}
repo_directory = os.path.join(code_path, 'git', repo_user, repo_name)

if PY2:
Expand Down

0 comments on commit e674eed

Please sign in to comment.