Skip to content

Commit 70d76c7

Browse files
committed
Merge branch 'issue-18941' of https://github.com/Nazar65/magento2 into issue-18941
2 parents 1378074 + 300772d commit 70d76c7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/Store/Model/Store.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,18 +1158,21 @@ public function isDefault()
11581158
* Retrieve current url for store
11591159
*
11601160
* @param bool $fromStore
1161-
* @param bool $clearUrl
11621161
* @return string
11631162
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
11641163
* @SuppressWarnings(PHPMD.NPathComplexity)
11651164
*/
1166-
public function getCurrentUrl($fromStore = true, $clearUrl = false)
1165+
public function getCurrentUrl($fromStore = true)
11671166
{
11681167
$sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession());
11691168
$requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/'));
11701169

11711170
$storeUrl = $this->getUrl('', ['_secure' => $this->_storeManager->getStore()->isCurrentlySecure()]);
11721171

1172+
if ($this->_config->getValue(self::XML_PATH_STORE_IN_URL)) {
1173+
$storeUrl = preg_replace('/\/'.$this->getCode().'{1}/','',$storeUrl);
1174+
}
1175+
11731176
if (!filter_var($storeUrl, FILTER_VALIDATE_URL)) {
11741177
return $storeUrl;
11751178
}
@@ -1212,10 +1215,6 @@ public function getCurrentUrl($fromStore = true, $clearUrl = false)
12121215

12131216
$currentUrlQueryParams = array_merge($requestString, $storeParsedQuery);
12141217

1215-
if ($clearUrl !== false) {
1216-
$currentUrlQueryParams = false;
1217-
}
1218-
12191218
$currentUrl = $storeParsedUrl['scheme']
12201219
. '://'
12211220
. $storeParsedUrl['host']

0 commit comments

Comments
 (0)