diff --git a/package_locator/common.py b/package_locator/common.py index 5e3750e..469b581 100644 --- a/package_locator/common.py +++ b/package_locator/common.py @@ -69,7 +69,7 @@ def get_base_repo_url(repo_url): def search_for_github_repo(data): urls = set() - url_pattern = re.compile(r"""https?:\/\/(?:www\.)?github\.com[^\s)|<|>]+""") + url_pattern = re.compile(r"""https?:\/\/(?:www\.)?github\.com[^\s)|<|>\"]+""") data = flatten(data) for k in data.keys(): if isinstance(data[k], str) and re.search(url_pattern, data[k]) and " " not in data[k]: diff --git a/package_locator/locator.py b/package_locator/locator.py index cb65212..bddd558 100644 --- a/package_locator/locator.py +++ b/package_locator/locator.py @@ -12,6 +12,8 @@ def search_github_url_in_json_data(ecosystem, package, json_data): subdir = locate_subdir(ecosystem, package, repo_url) return repo_url, subdir except Exception as e: + if repo_url!= None: + return repo_url, None continue return None, None @@ -123,4 +125,6 @@ def get_repository_url_and_subdir(ecosystem, package): elif ecosystem == CARGO: repo_url, subdir = get_cargo_location(package) - return get_base_repo_url(repo_url), postprocess_subdir(subdir) + if subdir != None: + return get_base_repo_url(repo_url), postprocess_subdir(subdir) + return get_base_repo_url(repo_url), None