Skip to content
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

fix for pypi underscore replace #26

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

declanhunter
Copy link
Contributor

I noticed #23 and decided to fix it with @DarthHater

I have adjusted the test to capture the issue and replace the code with the most broad solution

@DarthHater
Copy link
Contributor

@pombredanne @stevespringett , this is @declanhunter first open source contribution (ever!), and he's @glenhunter from @sonatype 's kiddo, so go easy on him :)

Way to go Declan!

@@ -57,7 +57,7 @@ class PackageURL {
}

_handlePyPi() {
this.name = this.name.toLowerCase().replace('_', '-');
this.name = this.name.toLowerCase().replace(/_/g, '-');
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at this with @declanhunter , we discovered (and I had no clue about this!) that replace with a substring only replaces the first occurrence. replaceAll doesn't appear to be available in node, so this regex solution for replace seemed the most broadly acceptable solution

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

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

Hey! Thanks ++ for taking a shot at this. This is looking great!
@steven-esser ? any feedback?

Copy link
Collaborator

@steven-esser steven-esser left a comment

Choose a reason for hiding this comment

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

@pombredanne looks good to me

@steven-esser steven-esser merged commit 155c13d into package-url:master Mar 29, 2022
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.

4 participants