Unexpected url validation behaviour

Hello,

I have an url field,

columns: 
  - width: 3/4
    fields:
      link:
        label: External Link
        type: url
        required: true

On localhost, the following url gives no problem when entering it into the field, saving the page, or making it public:

https://flash---art.com/2021/05/kw-digital-with-the-last-museum-a-website-specific-exhibition/#

…but on the staging sever, the same url gives an error only when trying to make the page public which I am not sure is the expected behaviour , I would expect the error to hit me when saving the page, not when making it public:

image

Sooo… what’s going on ?

Thank you

Kirby does not validate page while in draft state, therefore you will only get the error when you publish a page.

As to why it works locally but not on the remote server, I can’t tell.

1 Like

Thank you.

I tested directly the regex in the url function of the V class, and it seems that the triple hyphen in the url makes it invalid (actually anything more than one hyphen in ‘flash—art’)

See here.

So it is working as it should in staging, so I guess the question is why isn’t the validation working localhost ?

Thanks

In my local environment (Mac with Laravel Valet):

$url = 'https://flash---art.com/2021/05/kw-digital-with-the-last-museum-a-website-specific-exhibition/#';

var_dump(V::url($url));

returns false.

But in any case, this this URL exists and only the validator fails, you wouldn’t win much.