Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Oct 28, 2025

This matches the behaviour of the API, as implemented in google/osv.dev#3986 - there is also discussion of potentially normalizing for case but that is currently not being done by us anywhere and something we might only want to do for domains we know are case-insensitive like github.com and gitlab.com.

Resolves #2291

//
// Specifically, common protocols are removed from the start of the url and the
// ".git" suffix if present
func NormalizeRepo(repo string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSV.dev is a bit more aggressive when normalizing (removing all schemes, and trimming any possible trailing slashes) but I'm happy to do it more explicitly like you've done here.

I don't think there's any functional difference - I doubt we have any non-http(s)/git URLs in OSV.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I did it like this because in Go url.Parse returns an error which'd be really awkward to try handle here, so using TrimPrefix lets me avoid that (+ alternatively panicing) 😅

@G-Rath G-Rath force-pushed the offline-git-2-revenge-of-the branch from a79711c to 94f3ae7 Compare October 28, 2025 18:09
@G-Rath G-Rath force-pushed the offline-git-2-revenge-of-the branch from 94f3ae7 to 840ef6d Compare October 28, 2025 18:12
@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.95%. Comparing base (c1cab88) to head (840ef6d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2305      +/-   ##
==========================================
+ Coverage   67.94%   67.95%   +0.01%     
==========================================
  Files         172      172              
  Lines       12811    12816       +5     
==========================================
+ Hits         8704     8709       +5     
  Misses       3436     3436              
  Partials      671      671              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@another-rex another-rex merged commit e8890aa into google:main Oct 29, 2025
16 checks passed
@another-rex another-rex deleted the offline-git-2-revenge-of-the branch October 29, 2025 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

offline scan for C++ dependencies from Github project version

4 participants