Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ec882a

Browse files
Do not fix URL protocol for relative URLs
Example when it doesn't work correctly: /relative/path The data will be changed to "http:///relative/path" (3 slashes)
1 parent f5bc4a1 commit 7ec882a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function onSubmit(FormEvent $event)
3636
{
3737
$data = $event->getData();
3838

39-
if ($this->defaultProtocol && $data && \is_string($data) && !preg_match('~^[\w+.-]+://~', $data)) {
39+
if ($this->defaultProtocol && $data && \is_string($data) && !preg_match('~^[\w+.-]+://~', $data) && strpos($data, '/') === false) {
4040
$event->setData($this->defaultProtocol.'://'.$data);
4141
}
4242
}

0 commit comments

Comments
 (0)