Closed tikotzky closed 6 years ago
Was bumping into this issue when using refined-github
I modified the regex to not include commas if they are followed by a space. This means that currently
'https://sindresorhus.com/?id=foo,bar,'
// would become
'<a href="https://sindresorhus.com/?id=foo,bar">https://sindresorhus.com/?id=foo,bar,</a>'
// since the , is not followed by a space
and
'https://sindresorhus.com/?id=foo,bar,,'
// would become
'<a href="https://sindresorhus.com/?id=foo">https://sindresorhus.com/?id=foo, bar,</a>,'
// since the , is followed by another ,
I can modify the regex to exclude commas in those 2 scenarios, just not sure how complicated you want the regex to become.
here is a railroad diagram showing the regex as it is currently in this PR
you can view the railroad diagram here
If you want to disallow commas followed by commas or at the end of the line, the railroad diagram would look like this. link here
commas followed by commas
I think that's rare enough to not even be considered; I don't think writing http://url,,
makes much sense in the first place.
Currently if a urls with commas are truncated at the first comma for example
This PR adds a comma to the list of allowed path characters in the urlRegex.