neos / redirecthandler-ui

This package provides a backend module to manage Neos.RedirectHandler redirects which are stored in Neos.RedirectHandler.DatabaseStorage.
GNU General Public License v3.0
13 stars 14 forks source link

Allow for Colon (":") in Source URI Path #102

Open marco-wildermuth opened 3 hours ago

marco-wildermuth commented 3 hours ago

Greetings!

When trying to add a source URI path containing a colon (:) through the backend module the validation fails, because it is not allowed in the regex /^[a-z0-9_\-\/\.%]+$/i. It is possible to do it via commands:

./flow redirect:add --source 'category/subject:mysubject' --target 'category/subject:othersubject'

Although the colon is used in URIs for the protocol (like https://) or the port (like :80), it appears to be fine for usage in the URI path.

Related: In https://github.com/neos/redirecthandler-ui/issues/101 it was proposed to have the regex only in one place, not two.

Thank you.

Sebobo commented 3 hours ago

Hi thx for your issue. The validation was intended to be a bit more strict. But you can override it in your own settings and allow the colons. I personally never encountered urls with colons and there are some specific rules where they can occur see https://www.rfc-editor.org/rfc/rfc3986#section-3.3

Technically it was necessary to have two regex, as they are differently defined for JavaScript and PHP. We only found out some days ago, that there is a JS api to do server side validation and show it like other validations in the browser. This way we can keep the PHP regex and drop the js variant.