Skip to content

Conversation

@mgol
Copy link
Member

@mgol mgol commented Jan 31, 2018

The regular expression detecting the repository account+name didn't allow
accounts & repo names containing dashes because of matching both those parts
against the /\w+/ regexp. It was updated to match everything except the slash.

This made the release script fail for jQuery Color.

The regular expression detecting the repository account+name didn't allow
accounts & repo names containing dashes because of matching both those parts
against the /\w+/ regexp. It was updated to match everything except the slash.

This made the release script fail for jQuery Color.
_githubApiPath: function( path ) {
var repoUrl = Release._packageUrl( "bugs" );
var repo = repoUrl.match( /github\.com\/(\w+\/\w+)/ )[ 1 ];
var repo = repoUrl.match( /github\.com\/([^/]+\/[^/]+)/ )[ 1 ];
Copy link
Member

Choose a reason for hiding this comment

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

We can also use something like this – https://github.com/jonschlinkert/parse-github-url

Right?

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather look at this one-line regexp that's super clear for the case we care about than deal with a 143-line dependency that solves a much more general problem and seems to be unmaintained. Also, this regexp allows repos with leading special chars and that package does not.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. I prefer the regex.

Copy link
Member

Choose a reason for hiding this comment

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

Wow, a lot of arguments against, haha

@mgol mgol merged commit 591ca61 into jquery:master Feb 5, 2018
@mgol mgol deleted the regexp-fix branch February 5, 2018 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants