Skip to content

Commit e1a589c

Browse files
committed
Fix issue when appending the url parameters
1 parent f1194e9 commit e1a589c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,30 @@ public function getURL()
9494
if ($this->pageObjectID) {
9595
$handler = $this->getMenuPageHandler();
9696
if ($handler && $handler instanceof ILookupPageHandler) {
97-
return $handler->getLink($this->pageObjectID) . $this->urlParameters;
97+
return $this->appendUrlParameters($handler->getLink($this->pageObjectID));
9898
}
9999
}
100100

101101
if ($this->pageID) {
102-
return $this->getPage()->getLink() . $this->urlParameters;
102+
return $this->appendUrlParameters($this->getPage()->getLink());
103103
} else {
104104
return WCF::getLanguage()->get($this->externalURL);
105105
}
106106
}
107107

108+
private function appendUrlParameters(string $url): string
109+
{
110+
if (!$this->urlParameters) {
111+
return $url;
112+
}
113+
114+
if (\str_contains($url, '?')) {
115+
return $url .= '&' . $this->urlParameters;
116+
}
117+
118+
return $url .= '?' . $this->urlParameters;
119+
}
120+
108121
/**
109122
* Returns the page that is linked by this menu item.
110123
*

0 commit comments

Comments
 (0)