mirror of
				https://github.com/Icinga/icingaweb2.git
				synced 2025-11-03 20:54:27 +01:00 
			
		
		
		
	NavigationItemForm: Don't pre-optimize urls with a port-macro
fixes #2695
This commit is contained in:
		
							parent
							
								
									1b4522606d
								
							
						
					
					
						commit
						d246f76268
					
				@ -97,7 +97,10 @@ class NavigationItemForm extends Form
 | 
				
			|||||||
    public function getValues($suppressArrayNotation = false)
 | 
					    public function getValues($suppressArrayNotation = false)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $values = parent::getValues($suppressArrayNotation);
 | 
					        $values = parent::getValues($suppressArrayNotation);
 | 
				
			||||||
        if (isset($values['url']) && $values['url']) {
 | 
					        // 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'])) {
 | 
				
			||||||
            $url = Url::fromPath($values['url']);
 | 
					            $url = Url::fromPath($values['url']);
 | 
				
			||||||
            if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
 | 
					            if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
 | 
				
			||||||
                $values['url'] = $url->getRelativeUrl();
 | 
					                $values['url'] = $url->getRelativeUrl();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user