sindresorhus/refined-github

Support compare diff URLs in `prevent-pr-commit-link-loss` #3528

fregante posted onGitHub

Copy-paste this URL in a comment a click "Preview"

https://github.com/sindresorhus/got/compare/v11.5.2...v11.6.0#diff-6be2971b2bb8dbf48d15ff680dd898b0R191

GitHub changes the URL to the following, breaking it

https://github.com/sindresorhus/got/compare/v11.5.2...v11.6.0diff-6be2971b2bb8dbf48d15ff680dd898b0R191

This is a similar GitHub bug to https://github.com/sindresorhus/refined-github/issues/2327, which was fixed by https://github.com/sindresorhus/refined-github/pull/3085 (prevent-pr-commit-link-loss), so it'd make sense to extend that feature


can I work on this issue?

posted by esakki-selvaraj over 4 years ago

@esakki-selvaraj go for it!

posted by yakov116 over 4 years ago

@yakov116 Can i get some more links so that I can check my Reg Expression!

posted by esakki-selvaraj over 4 years ago

Keep in mind that there's a pretty advanced regex (which avoids selecting the url twice) already set up:

https://github.com/sindresorhus/refined-github/blob/6d339762d762b669bb48b2977f40a83c48305a2d/source/github-helpers/index.ts#L98-L99

And tested:

https://github.com/sindresorhus/refined-github/blob/86529e79015ea54b2eda9f06a1aca692acf7baea/test/helpers.ts#L176-L211

You should start from that regex: copy the regex, copy the tests (changing only the URLs) and make sure they pass.

posted by fregante over 4 years ago

it's working

posted by esakki-selvaraj over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests