Skip to content

Commit

Permalink
Merge pull request #705 from mfocko/fix-pagure-from-url
Browse files Browse the repository at this point in the history
fix(pagure): raise for invalid URL in pagure

When using PagureService.get_project_from_url test for correctly parsed
URL before accessing its attributes (resulting in AttributeError).
Fixes #698
Signed-off-by: Matej Focko [email protected]
RELEASE NOTES BEGIN
ogr now correctly raises OgrException when given invalid URL to PagureService.get_project_from_url.
RELEASE NOTES END

Reviewed-by: Jiri Popelka <None>
  • Loading branch information
softwarefactory-project-zuul[bot] authored Apr 27, 2022
2 parents 034c5d0 + 6073253 commit 0ef457d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ogr/services/pagure/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def get_project(self, **kwargs) -> "PagureProject":

def get_project_from_url(self, url: str) -> "PagureProject":
repo_url = parse_git_repo(potential_url=url)
if not repo_url:
raise OgrException(f"Cannot parse project url: '{url}'")

if not repo_url.is_fork:
repo_url.username = None

Expand Down

0 comments on commit 0ef457d

Please sign in to comment.