-
-
Notifications
You must be signed in to change notification settings - Fork 264
Fix get_advisory_url to handle string file paths #2102
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
base: main
Are you sure you want to change the base?
Conversation
The function now accepts both Path objects and strings for the `file` and `base_path` parameters, converting strings to Path objects before calling relative_to(). This fixes the AttributeError that occurred when importers passed string paths instead of Path objects. Fixes: aboutcode-org#2016 Signed-off-by: Mrityunjay Raj <mr.raj.earth@gmail.com>
f68153c to
1608222
Compare
|
@mr-raj12, could you please add a simple test for the |
- Test string inputs (the bug fix scenario) - Test Path object inputs (original working case) - Test mixed Path/string inputs Addresses reviewer feedback Signed-off-by: Mrityunjay Raj <mr.raj.earth@gmail.com>
|
@ziadhany Test added for The test covers:
All tests pass locally. The PR is ready for review. |
|
@ziadhany Test has been added as requested. All test suites pass successfully. Note: The documentation build is failing due to a broken link in Could you please advise if I should:
Let me know if you'd like me to fix the documentation link as part of this PR. |
|
@mr-raj12 Ignore the CI docs for now, just run the Istio importer locally again and print the logs. |
|
@ziadhany ran the Istio importer locally as requested. The fix works correctly - no more The importer successfully processed all 50 Istio advisories without errors. |
Summary
get_advisory_url()inutils.pyto accept bothPathobjects and stringsPathobjects before calling.relative_to()AttributeError: 'str' object has no attribute 'relative_to'errorIssue
Fixes :
Changes
from pathlib import Pathimportisinstance()to convert strings to Path objectsTesting
Signed-off-by: Mrityunjay Raj mr.raj.earth@gmail.com