The link module threw up a "Not a valid URL" warning when I tried to input the valid URL http://_grisha.livejournal.com/ . (Seriously, it works: Go there to see.)

The actual version that encountered the problem is 7.x-1.0+28-dev, part of Commerce Kickstart as of 16 January 2013.

CommentFileSizeAuthor
#1 link-url_match-1890764.patch998 bytesxiukun.zhou

Comments

xiukun.zhou’s picture

Status: Active » Needs review
StatusFileSize
new998 bytes
chris matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 16 Jan 2013 patch to link.module does not apply to the latest link 7.x-1.x-dev and if still applicable needs a reroll.

error: while searching for:
  // Starting a parenthesis group with (?: means that it is grouped, but is not captured
  $protocol = '((?:'. implode("|", $allowed_protocols) .'):\/\/)';
  $authentication = "(?:(?:(?:[\w\.\-\+!$&'\(\)*\+,;=" . $LINK_ICHARS . "]|%[0-9a-f]{2})+(?::(?:[\w". $LINK_ICHARS ."\.\-\+%!$&'\(\)*\+,;=]|%[0-9a-f]{2})*)?)?@)";
  $domain = '(?:(?:[a-z0-9' . $LINK_ICHARS_DOMAIN . ']([a-z0-9'. $LINK_ICHARS_DOMAIN . '\-_\[\]])*)(\.(([a-z0-9' . $LINK_ICHARS_DOMAIN . '\-_\[\]])+\.)*('. LINK_DOMAINS .'|[a-z]{2}))?)';
  $ipv4 = '(?:[0-9]{1,3}(\.[0-9]{1,3}){3})';
  $ipv6 = '(?:[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7})';
  $port = '(?::([0-9]{1,5}))';

error: patch failed: link.module:1156
error: link.module: patch does not apply
sajid_007’s picture

I added a link in my content that starts with underscores and without applying a patch it is perfectly working in current version.

pradeepjha’s picture

Status: Needs work » Needs review

Last patch itself is wrong. I didn't see any pattern matching value is changed. Only variable name is made in caps format, which is wrong. Because that variables are not available.
Also that means without patch also functionality is already working fine. I'm totally agree with @sajid_007.

solideogloria’s picture

Can someone provide steps for how to reproduce the error?

Perhaps the URL validation should be expanded: https://stackoverflow.com/questions/161738/what-is-the-best-regular-expr...

chegor’s picture

When I tried to insert this link into my "Website" field with type "Link" I got an error:
The value https://_grisha.livejournal.com provided for Website is not a valid URL.
I'm using Link 7.x-1.7

damienmckenna’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

@chegor: The patch hasn't been committed, this is an outstanding problem. And it needs test coverage.