OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Link Field for url with anchor #4129

Open orchardbot opened 10 years ago

orchardbot commented 10 years ago

neTp9c created: https://orchard.codeplex.com/workitem/20300

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

orchardbot commented 10 years ago

@bleroy commented:

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

orchardbot commented 10 years ago

AimOrchard commented:

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?

orchardbot commented 10 years ago

@agriffard commented:

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 ?

orchardbot commented 10 years ago

neTp9c commented:

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.

orchardbot commented 10 years ago

@sebastienros commented:

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.