From f98ed076ce3730f8738924df838745389c97aa4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Tue, 27 Aug 2019 13:17:19 +0200 Subject: [PATCH] The URL field of an attachment must contain a valid url. --- src/Form/AttachmentFormType.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index df383ab2..f7d3f724 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -45,6 +45,7 @@ use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\File; +use Symfony\Component\Validator\Constraints\Url; class AttachmentFormType extends AbstractType { @@ -74,7 +75,10 @@ class AttachmentFormType extends AbstractType $builder->add('url', UrlType::class, [ 'label' => 'attachment.edit.url', - 'required' => false + 'required' => false, + 'constraints' => [ + new Url() + ] ]); $builder->add('file', FileType::class, [