Merge pull request #3405 from Icinga/fix/nav-item-urls-with-partial-port-macros-are-not-saved-3301

NavigationItemForm: Fix that urls with partial port macros are not saved
This commit is contained in:
Johannes Meyer 2018-04-04 11:37:52 +02:00 committed by GitHub
commit 8262f19c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ class NavigationItemForm extends Form
// The regex here specifically matches the port-macro as it's the only one preventing Url::fromPath() from
// successfully parsing the given url. Any other macro such as for the scheme or host simply gets identified
// as path which is just fine in this case.
if (isset($values['url']) && $values['url'] && !preg_match('~://.+:(\$.+\$)~', $values['url'])) {
if (isset($values['url']) && $values['url'] && !preg_match('~://.+:\d*?(\$.+\$)~', $values['url'])) {
$url = Url::fromPath($values['url']);
if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
$values['url'] = $url->getRelativeUrl();