-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For solving error for cases when github repo is found however subdir is None #13
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In The rationale here is that we can pass in any data to this function, e.g., package homepage, which may contain various GitHub URLs in the data for whatever reason. Therefore, a validation step here is a must. Let me know if I'm missing anything. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. This is indeed a bug. I introduced it in the last commit on this file, it seems, but I think I processed my data set before introducing this bug. But we definitely need to fix this, and add a test case for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On a second thought, the change needs to happen within There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show me a test case where a backslash would help?
Also, are we sure that a backslash cannot legitimately appear within a URL?