Skip to content

Commit 67f2f49

Browse files
authored
Merge pull request #5208 from magento-borg/borg-2.3.5
[CIA] Bug fixes
2 parents 49a42a4 + 935e1f2 commit 67f2f49

File tree

4 files changed

+47
-14
lines changed

4 files changed

+47
-14
lines changed

app/code/Magento/Directory/Block/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function getCountryHtmlSelect($defValue = null, $name = 'country_id', $id
142142
)->setId(
143143
$id
144144
)->setTitle(
145-
__($title)
145+
$this->escapeHtmlAttr(__($title))
146146
)->setValue(
147147
$defValue
148148
)->setOptions(

app/code/Magento/Directory/Test/Unit/Block/DataTest.php

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Store\Model\ScopeInterface;
1818
use Magento\Store\Model\Store;
1919
use Magento\Store\Model\StoreManagerInterface;
20+
use Magento\Framework\Escaper;
2021

2122
/**
2223
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -56,9 +57,19 @@ class DataTest extends \PHPUnit\Framework\TestCase
5657
/** @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */
5758
private $serializerMock;
5859

60+
/**
61+
* @var \Magento\Framework\Escaper
62+
*/
63+
private $escaper;
64+
5965
protected function setUp()
6066
{
6167
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
68+
$this->escaper = $this->getMockBuilder(Escaper::class)
69+
->disableOriginalConstructor()
70+
->setMethods(['escapeHtmlAttr'])
71+
->getMock();
72+
6273
$this->prepareContext();
6374

6475
$this->helperDataMock = $this->getMockBuilder(\Magento\Directory\Helper\Data::class)
@@ -123,6 +134,8 @@ protected function prepareContext()
123134
$this->contextMock->expects($this->any())
124135
->method('getLayout')
125136
->willReturn($this->layoutMock);
137+
138+
$this->contextMock->expects($this->once())->method('getEscaper')->willReturn($this->escaper);
126139
}
127140

128141
protected function prepareCountryCollection()
@@ -135,9 +148,11 @@ protected function prepareCountryCollection()
135148
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory::class
136149
)
137150
->disableOriginalConstructor()
138-
->setMethods([
139-
'create'
140-
])
151+
->setMethods(
152+
[
153+
'create'
154+
]
155+
)
141156
->getMock();
142157

143158
$this->countryCollectionFactoryMock->expects($this->any())
@@ -285,15 +300,17 @@ protected function mockElementHtmlSelect($defaultCountry, $options, $resultHtml)
285300

286301
$elementHtmlSelect = $this->getMockBuilder(\Magento\Framework\View\Element\Html\Select::class)
287302
->disableOriginalConstructor()
288-
->setMethods([
289-
'setName',
290-
'setId',
291-
'setTitle',
292-
'setValue',
293-
'setOptions',
294-
'setExtraParams',
295-
'getHtml',
296-
])
303+
->setMethods(
304+
[
305+
'setName',
306+
'setId',
307+
'setTitle',
308+
'setValue',
309+
'setOptions',
310+
'setExtraParams',
311+
'getHtml'
312+
]
313+
)
297314
->getMock();
298315

299316
$elementHtmlSelect->expects($this->once())
@@ -323,6 +340,10 @@ protected function mockElementHtmlSelect($defaultCountry, $options, $resultHtml)
323340
$elementHtmlSelect->expects($this->once())
324341
->method('getHtml')
325342
->willReturn($resultHtml);
343+
$this->escaper->expects($this->once())
344+
->method('escapeHtmlAttr')
345+
->with(__($title))
346+
->willReturn(__($title));
326347

327348
return $elementHtmlSelect;
328349
}

nginx.conf.sample

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ location / {
9393
}
9494

9595
location /pub/ {
96-
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) {
96+
location ~ ^/pub/media/(downloadable|customer|import|custom_options|theme_customization/.*\.xml) {
9797
deny all;
9898
}
9999
alias $MAGE_ROOT/pub/;
@@ -166,6 +166,11 @@ location /media/downloadable/ {
166166
location /media/import/ {
167167
deny all;
168168
}
169+
170+
location /media/custom_options/ {
171+
deny all;
172+
}
173+
169174
location /errors/ {
170175
location ~* \.xml$ {
171176
deny all;

pub/media/custom_options/.htaccess

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<IfVersion < 2.4>
2+
order deny,allow
3+
deny from all
4+
</IfVersion>
5+
<IfVersion >= 2.4>
6+
Require all denied
7+
</IfVersion>

0 commit comments

Comments
 (0)