Skip to content

Commit aa79287

Browse files
author
Alexander Akimov
authored
Merge pull request #2782 from magento-plankton/2.1.14-merged
[Plankton]: Merge 2.1.14 Release into 2.1-develop Branch
2 parents 2c15d27 + 5adf28c commit aa79287

File tree

59 files changed

+1588
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1588
-378
lines changed

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1+
2.1.14
2+
=============
3+
* GitHub issues:
4+
* [#7723](https://github.com/magento/magento2/issues/7723) -- Catalog rule contains-condition not saving multiple selection in 2.1.2 (fixed in [magento/magento2#13546](https://github.com/magento/magento2/pull/13546))
5+
* [#13214](https://github.com/magento/magento2/issues/13214) -- Not a correct displaying for Robots.txt (fixed in [magento/magento2#13550](https://github.com/magento/magento2/pull/13550))
6+
* [#13315](https://github.com/magento/magento2/issues/13315) -- Mobile "Payment Methods" step looks bad on mobile (fixed in [magento/magento2#13980](https://github.com/magento/magento2/pull/13980))
7+
* [#13474](https://github.com/magento/magento2/issues/13474) -- [2.1.10] Swagger not working for multistore installs? (fixed in [magento/magento2#13486](https://github.com/magento/magento2/pull/13486))
8+
* [#4173](https://github.com/magento/magento2/issues/4173) -- Cron schedule bug (fixed in [magento/magento2#14096](https://github.com/magento/magento2/pull/14096))
9+
* [#5808](https://github.com/magento/magento2/issues/5808) -- [2.1.0] Problem on mobile when catalog gallery allowfullscreen is false (fixed in [magento/magento2#14098](https://github.com/magento/magento2/pull/14098))
10+
* [#6694](https://github.com/magento/magento2/issues/6694) -- Override zip_codes.xml (fixed in [magento/magento2#14117](https://github.com/magento/magento2/pull/14117))
11+
* [#10559](https://github.com/magento/magento2/issues/10559) -- Extending swatch functionality using javascript mixins does not work in Safari and MS Edge (fixed in [magento/magento2#12928](https://github.com/magento/magento2/pull/12928))
12+
* [#3489](https://github.com/magento/magento2/issues/3489) -- CURL Json POST (fixed in [magento/magento2#14151](https://github.com/magento/magento2/pull/14151))
13+
* [#5463](https://github.com/magento/magento2/issues/5463) -- The ability to store passwords using different hashing algorithms is limited (fixed in [magento/magento2#13886](https://github.com/magento/magento2/pull/13886))
14+
* [#3882](https://github.com/magento/magento2/issues/3882) -- An XML comment node as parameter in widget.xml fails with fatal error (fixed in [magento/magento2#14219](https://github.com/magento/magento2/pull/14219))
15+
* [#1931](https://github.com/magento/magento2/issues/1931) -- Can't cancel removal of a block or container in layout by setting remove attribute value to false (fixed in [magento/magento2#14198](https://github.com/magento/magento2/pull/14198))
16+
* [#7403](https://github.com/magento/magento2/issues/7403) -- JS Translation Regex leads to unexpected results and untranslatable strings (fixed in [magento/magento2#14349](https://github.com/magento/magento2/pull/14349))
17+
* [#7816](https://github.com/magento/magento2/issues/7816) -- Customer_account.xml file abused (fixed in [magento/magento2#14323](https://github.com/magento/magento2/pull/14323))
18+
* [#10700](https://github.com/magento/magento2/issues/10700) -- Magento 2 Admin panel show loading on each page (fixed in [magento/magento2#14417](https://github.com/magento/magento2/pull/14417))
19+
* [#11930](https://github.com/magento/magento2/issues/11930) -- setup:di:compile's generated cache files inaccessible by the web-server user (fixed in [magento/magento2#14417](https://github.com/magento/magento2/pull/14417))
20+
* [#14572](https://github.com/magento/magento2/issues/14572) -- Specify the table when adding field to filter for the collection Eav/Model/ResourceModel/Entity/Attribute/Option/Collection.php (fixed in [magento/magento2#14596](https://github.com/magento/magento2/pull/14596))
21+
* GitHub pull requests:
22+
* [magento/magento2#13949](https://github.com/magento/magento2/pull/13949) -- Fix misnamed namespace (by @Ethan3600)
23+
* [magento/magento2#13545](https://github.com/magento/magento2/pull/13545) -- Backport of PR-5028 for Magento 2.1: Load jquery using requirejs to p… (by @hostep)
24+
* [magento/magento2#13546](https://github.com/magento/magento2/pull/13546) -- Backport of PR-8246 for Magento 2.1: Fixes #7723 - saving multi selec… (by @hostep)
25+
* [magento/magento2#13550](https://github.com/magento/magento2/pull/13550) -- Backport of MAGETWO-84006 for Magento 2.1: Fix robots.txt content typ… (by @hostep)
26+
* [magento/magento2#13896](https://github.com/magento/magento2/pull/13896) -- MAGETWO-59112 Backport 2.1.x (by @Ctucker9233)
27+
* [magento/magento2#13812](https://github.com/magento/magento2/pull/13812) -- [Backport 2.1] Add RewriteBase directive template in .htaccess file into pub/static folder (by @ccasciotti)
28+
* [magento/magento2#13658](https://github.com/magento/magento2/pull/13658) -- [Backport 2.1-develop] Show redirect_to_base config in store scope (by @JeroenVanLeusden)
29+
* [magento/magento2#13980](https://github.com/magento/magento2/pull/13980) -- Backport of PR-13777. Mobile 'Payments methods' step looks bad on mobile (by @Frodigo)
30+
* [magento/magento2#13987](https://github.com/magento/magento2/pull/13987) -- Backport of PR-13750 for Magento 2.1: Less clean up (by @Karlasa)
31+
* [magento/magento2#14022](https://github.com/magento/magento2/pull/14022) -- fix catalog_rule_promo_catalog_edit.xml layout (by @Karlasa)
32+
* [magento/magento2#13806](https://github.com/magento/magento2/pull/13806) -- [Backport 2.1] Add quoting for base path in DI compile command (by @simpleadm)
33+
* [magento/magento2#13486](https://github.com/magento/magento2/pull/13486) -- [Backport 2.1-develop] Change the store code in Swagger based on a param (by @JeroenVanLeusden)
34+
* [magento/magento2#14096](https://github.com/magento/magento2/pull/14096) -- [Backport 2.1] Schedule generation was broken (by @simpleadm)
35+
* [magento/magento2#14098](https://github.com/magento/magento2/pull/14098) -- [Backport 2.1] MAGETWO-64250 Problem on mobile when catalog gallery allowfullscreen is false (by @simpleadm)
36+
* [magento/magento2#14115](https://github.com/magento/magento2/pull/14115) -- [Backport 2.1] MAGETWO-71697: Fix possible bug when saving address with empty street line (by @simpleadm)
37+
* [magento/magento2#14117](https://github.com/magento/magento2/pull/14117) -- [Backport 2.1] MAGETWO-59258: Override module-directory/etc/zip_codes.xml only the last code of a country gets include (by @simpleadm)
38+
* [magento/magento2#12928](https://github.com/magento/magento2/pull/12928) -- Issues #10559 - Extend swatch using mixins (M2.1) (by @srenon)
39+
* [magento/magento2#14151](https://github.com/magento/magento2/pull/14151) -- [Backport 2.1] 8373: Fix CURL Json POST (by @simpleadm)
40+
* [magento/magento2#13886](https://github.com/magento/magento2/pull/13886) -- #5463 - Use specified hashing algo in \Magento\Framework\Encryption\Encryptor::getHash (by @k4emic)
41+
* [magento/magento2#14168](https://github.com/magento/magento2/pull/14168) -- [Backport 2.1] Added mage/translate component to customers's ajax login (by @ccasciotti)
42+
* [magento/magento2#13654](https://github.com/magento/magento2/pull/13654) -- [Backport 2.1-develop] Update Store getConfig() to respect valid false return value (by @JeroenVanLeusden)
43+
* [magento/magento2#14219](https://github.com/magento/magento2/pull/14219) -- Backport of PR-8772 for Magento 2.1: magento/magento2#3882 (by @hostep)
44+
* [magento/magento2#14198](https://github.com/magento/magento2/pull/14198) -- [Backport] Can't cancel removal of a block or container in layout by setting remove attribute value to false (by @quisse)
45+
* [magento/magento2#14349](https://github.com/magento/magento2/pull/14349) -- Backport of PR-10445 for Magento 2.1: Fix JS translation search (by @hostep)
46+
* [magento/magento2#14332](https://github.com/magento/magento2/pull/14332) -- Backport: Fix for broken navigation menu on IE11 #14230 (by @sergiy-v)
47+
* [magento/magento2#14323](https://github.com/magento/magento2/pull/14323) -- #7816: Customer_account.xml file abused (2.1) (by @mikewhitby)
48+
* [magento/magento2#14417](https://github.com/magento/magento2/pull/14417) -- [BACKPORT 2.1] Removed cache backend option which explicitly set file permissions (by @xtremeperf)
49+
* [magento/magento2#14436](https://github.com/magento/magento2/pull/14436) -- Fix HTML tags in meta description (by @vseager)
50+
* [magento/magento2#14480](https://github.com/magento/magento2/pull/14480) -- [Backport 2.1] Return status in console commands (by @simpleadm)
51+
* [magento/magento2#14497](https://github.com/magento/magento2/pull/14497) -- [backport] fix for button color in email template (by @Karlasa)
52+
* [magento/magento2#14348](https://github.com/magento/magento2/pull/14348) -- [Backport 2.1] Add json and xml support to the post method in socket client (by @simpleadm)
53+
* [magento/magento2#14479](https://github.com/magento/magento2/pull/14479) -- [Backport 2.1] Configurable product price options by store (by @simpleadm)
54+
* [magento/magento2#14505](https://github.com/magento/magento2/pull/14505) -- [Backport] Check if store id is not null instead of empty (by @quisse)
55+
* [magento/magento2#14524](https://github.com/magento/magento2/pull/14524) -- [backport] fix translation issue with rating stars (by @Karlasa)
56+
* [magento/magento2#14596](https://github.com/magento/magento2/pull/14596) -- Specify the table when adding field to filter (by @PierreLeMaguer)
57+
158
2.1.13
259
=============
360
* GitHub issues:

app/code/Magento/Backend/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"magento/framework": "100.1.*"
2323
},
2424
"type": "magento2-module",
25-
"version": "100.1.8",
25+
"version": "100.1.9",
2626
"license": [
2727
"OSL-3.0",
2828
"AFL-3.0"

app/code/Magento/Catalog/Model/ImageUploader.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ class ImageUploader
6464
*/
6565
protected $allowedExtensions;
6666

67+
/**
68+
* List of allowed image mime types.
69+
*
70+
* @var array
71+
*/
72+
private $allowedMimeTypes = [
73+
'image/jpg',
74+
'image/jpeg',
75+
'image/gif',
76+
'image/png',
77+
];
78+
6779
/**
6880
* ImageUploader constructor
6981
*
@@ -218,6 +230,7 @@ public function moveFileFromTmp($imageName)
218230
* @return string[]
219231
*
220232
* @throws \Magento\Framework\Exception\LocalizedException
233+
* @throws \Exception
221234
*/
222235
public function saveFileToTmpDir($fileId)
223236
{
@@ -228,6 +241,10 @@ public function saveFileToTmpDir($fileId)
228241
$uploader->setAllowedExtensions($this->getAllowedExtensions());
229242
$uploader->setAllowRenameFiles(true);
230243

244+
if (!$uploader->checkMimeType($this->allowedMimeTypes)) {
245+
throw new \Magento\Framework\Exception\LocalizedException(__('File validation failed.'));
246+
}
247+
231248
$result = $uploader->save($this->mediaDirectory->getAbsolutePath($baseTmpPath));
232249
unset($result['path']);
233250

app/code/Magento/Catalog/Model/Product/Gallery/UpdateHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ protected function processDeletedImages($product, array &$images)
2828
foreach ($images as &$image) {
2929
if (!empty($image['removed'])) {
3030
if (!empty($image['value_id']) && !isset($picturesInOtherStores[$image['file']])) {
31+
if (preg_match('/\.\.(\\\|\/)/', $image['file'])) {
32+
continue;
33+
}
3134
$recordsToDelete[] = $image['value_id'];
3235
$catalogPath = $this->mediaConfig->getBaseMediaPath();
3336
$isFile = $this->mediaDirectory->isFile($catalogPath . $image['file']);
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Test\Unit\Model;
7+
8+
/**
9+
* Magento\Catalog\Model\ImageUploader unit tests.
10+
*/
11+
class ImageUploaderTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var \Magento\Catalog\Model\ImageUploader
15+
*/
16+
private $imageUploader;
17+
18+
/**
19+
* Core file storage database.
20+
*
21+
* @var \Magento\MediaStorage\Helper\File\Storage\Database|\PHPUnit_Framework_MockObject_MockObject
22+
*/
23+
private $coreFileStorageDatabaseMock;
24+
25+
/**
26+
* Media directory object (writable).
27+
*
28+
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $mediaDirectoryMock;
31+
32+
/**
33+
* Media directory object (writable).
34+
*
35+
* @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
private $mediaWriteDirectoryMock;
38+
39+
/**
40+
* Uploader factory.
41+
*
42+
* @var \Magento\MediaStorage\Model\File\UploaderFactory|\PHPUnit_Framework_MockObject_MockObject
43+
*/
44+
private $uploaderFactoryMock;
45+
46+
/**
47+
* Store manager.
48+
*
49+
* @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
50+
*/
51+
private $storeManagerMock;
52+
53+
/**
54+
* @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
55+
*/
56+
private $loggerMock;
57+
58+
/**
59+
* Base tmp path.
60+
*
61+
* @var string
62+
*/
63+
private $baseTmpPath;
64+
65+
/**
66+
* Base path.
67+
*
68+
* @var string
69+
*/
70+
private $basePath;
71+
72+
/**
73+
* Allowed extensions.
74+
*
75+
* @var string
76+
*/
77+
private $allowedExtensions;
78+
79+
/**
80+
* @inheritdoc
81+
*/
82+
protected function setUp()
83+
{
84+
$this->coreFileStorageDatabaseMock = $this->getMockBuilder(
85+
\Magento\MediaStorage\Helper\File\Storage\Database::class
86+
)
87+
->disableOriginalConstructor()
88+
->getMock();
89+
$this->mediaDirectoryMock = $this->getMockBuilder(
90+
\Magento\Framework\Filesystem::class
91+
)
92+
->disableOriginalConstructor()
93+
->getMock();
94+
$this->mediaWriteDirectoryMock = $this->getMockBuilder(
95+
\Magento\Framework\Filesystem\Directory\WriteInterface::class
96+
)
97+
->disableOriginalConstructor()
98+
->getMock();
99+
$this->mediaDirectoryMock->expects($this->any())->method('getDirectoryWrite')->willReturn(
100+
$this->mediaWriteDirectoryMock
101+
);
102+
$this->uploaderFactoryMock = $this->getMockBuilder(
103+
\Magento\MediaStorage\Model\File\UploaderFactory::class
104+
)
105+
->disableOriginalConstructor()
106+
->getMock();
107+
$this->storeManagerMock = $this->getMockBuilder(
108+
\Magento\Store\Model\StoreManagerInterface::class
109+
)
110+
->disableOriginalConstructor()
111+
->getMock();
112+
$this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
113+
->disableOriginalConstructor()
114+
->getMock();
115+
$this->baseTmpPath = 'base/tmp/';
116+
$this->basePath = 'base/real/';
117+
$this->allowedExtensions = ['.jpg'];
118+
119+
$this->imageUploader =
120+
new \Magento\Catalog\Model\ImageUploader(
121+
$this->coreFileStorageDatabaseMock,
122+
$this->mediaDirectoryMock,
123+
$this->uploaderFactoryMock,
124+
$this->storeManagerMock,
125+
$this->loggerMock,
126+
$this->baseTmpPath,
127+
$this->basePath,
128+
$this->allowedExtensions
129+
);
130+
}
131+
132+
public function testSaveFileToTmpDir()
133+
{
134+
$fileId = 'file.jpg';
135+
$allowedMimeTypes = [
136+
'image/jpg',
137+
'image/jpeg',
138+
'image/gif',
139+
'image/png',
140+
];
141+
/** @var \Magento\MediaStorage\Model\File\Uploader|\PHPUnit_Framework_MockObject_MockObject $uploader */
142+
$uploader = $this->getMockBuilder(\Magento\MediaStorage\Model\File\Uploader::class)
143+
->disableOriginalConstructor()
144+
->getMock();
145+
$this->uploaderFactoryMock->expects($this->once())->method('create')->willReturn($uploader);
146+
$uploader->expects($this->once())->method('setAllowedExtensions')->with($this->allowedExtensions);
147+
$uploader->expects($this->once())->method('setAllowRenameFiles')->with(true);
148+
$this->mediaWriteDirectoryMock->expects($this->once())->method('getAbsolutePath')->with($this->baseTmpPath)
149+
->willReturn($this->basePath);
150+
$uploader->expects($this->once())->method('save')->with($this->basePath)
151+
->willReturn(['tmp_name' => $this->baseTmpPath, 'file' => $fileId, 'path' => $this->basePath]);
152+
$uploader->expects($this->atLeastOnce())->method('checkMimeType')->with($allowedMimeTypes)->willReturn(true);
153+
$storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class)
154+
->disableOriginalConstructor()
155+
->setMethods(['getBaseUrl'])
156+
->getMock();
157+
158+
$this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock);
159+
$storeMock->expects($this->once())->method('getBaseUrl');
160+
$this->coreFileStorageDatabaseMock->expects($this->once())->method('saveFile');
161+
162+
$result = $this->imageUploader->saveFileToTmpDir($fileId);
163+
164+
$this->assertArrayNotHasKey('path', $result);
165+
}
166+
}

app/code/Magento/Catalog/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"magento/module-catalog-sample-data": "Sample Data version:100.1.*"
3434
},
3535
"type": "magento2-module",
36-
"version": "101.0.13",
36+
"version": "101.0.14",
3737
"license": [
3838
"OSL-3.0",
3939
"AFL-3.0"

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
use Magento\Framework\App\Filesystem\DirectoryList;
99
use Magento\Framework\Filesystem\DriverPool;
10+
use Magento\Framework\App\ObjectManager;
1011

1112
/**
1213
* Import entity product model
1314
*
15+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1416
* @author Magento Core Team <[email protected]>
1517
*/
1618
class Uploader extends \Magento\MediaStorage\Model\File\Uploader
@@ -85,6 +87,11 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
8587
*/
8688
protected $_coreFileStorage;
8789

90+
/**
91+
* @var \Magento\Framework\App\Filesystem\DirectoryResolver
92+
*/
93+
private $directoryResolver;
94+
8895
/**
8996
* @param \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDb
9097
* @param \Magento\MediaStorage\Helper\File\Storage $coreFileStorage
@@ -93,6 +100,7 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
93100
* @param \Magento\Framework\Filesystem $filesystem
94101
* @param \Magento\Framework\Filesystem\File\ReadFactory $readFactory
95102
* @param null $filePath
103+
* @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
96104
* @throws \Magento\Framework\Exception\LocalizedException
97105
*/
98106
public function __construct(
@@ -102,7 +110,8 @@ public function __construct(
102110
\Magento\MediaStorage\Model\File\Validator\NotProtectedExtension $validator,
103111
\Magento\Framework\Filesystem $filesystem,
104112
\Magento\Framework\Filesystem\File\ReadFactory $readFactory,
105-
$filePath = null
113+
$filePath = null,
114+
\Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null
106115
) {
107116
if ($filePath !== null) {
108117
$this->_setUploadFile($filePath);
@@ -113,6 +122,8 @@ public function __construct(
113122
$this->_validator = $validator;
114123
$this->_directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
115124
$this->_readFactory = $readFactory;
125+
$this->directoryResolver = $directoryResolver
126+
?: ObjectManager::getInstance()->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);
116127
}
117128

118129
/**
@@ -217,6 +228,7 @@ protected function _validateFile()
217228

218229
$fileExtension = pathinfo($filePath, PATHINFO_EXTENSION);
219230
if (!$this->checkAllowedExtension($fileExtension)) {
231+
$this->_directory->delete($filePath);
220232
throw new \Exception('Disallowed file type.');
221233
}
222234
//run validate callbacks
@@ -262,7 +274,10 @@ public function getTmpDir()
262274
*/
263275
public function setTmpDir($path)
264276
{
265-
if (is_string($path) && $this->_directory->isReadable($path)) {
277+
if (is_string($path)
278+
&& $this->_directory->isReadable($path)
279+
&& $this->directoryResolver->validatePath($this->_directory->getAbsolutePath($path), DirectoryList::ROOT)
280+
) {
266281
$this->_tmpDir = $path;
267282
return true;
268283
}

0 commit comments

Comments
 (0)