2
Vote

Link Field for url with anchor

description

Url with anchor (/page#anchor) in Link Field is not valid

comments

BertrandLeRoy wrote Nov 25, 2013 at 9:09 AM

This looks like something that would be just fine as a module. Why does this need to be in core?

AimOrchard wrote Nov 25, 2013 at 9:32 AM

What are you with the core, if it cannot handle core features?

A link that you can click can contain an anchor, why should you disallow this?

agriffard wrote Nov 25, 2013 at 12:24 PM

The LinkFieldDriver tests if the Url is valid using the method Uri.IsWellFormedUriString()
As you noticed, it seems that it returns an error with '/page#anchor'.

Can you use 'http://www.yoursiteurl/page/#anchor', which is valid ?

neTp9c wrote Nov 25, 2013 at 5:56 PM

http://domain.com/page#anchor is valid but /page#anchor is not valid. It is not right.

Disallow anchor same disallow slash as end url.

sebastienros wrote Aug 7 at 8:08 PM

Ok to fix, the solution is to remove the #value before checking the validity of the url, then add it back if the url is valid.