Skip to content

Commit 6d3e42c

Browse files
committed
Merge remote-tracking branch '38074/fix-for-issue-37957' into comm_prs_247beta3_dec
2 parents ee507f6 + e5b47d7 commit 6d3e42c

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/internal/Magento/Framework/File/Uploader.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ private function validateDestination(string $destinationFolder): void
342342
* @return void
343343
*
344344
* @deprecated 100.0.8
345+
* @see Nothing
345346
*/
346347
protected function chmod($file)
347348
{
@@ -383,8 +384,9 @@ protected function _moveFile($tmpPath, $destPath)
383384
/**
384385
* Get logger instance.
385386
*
386-
* @deprecated
387387
* @return LoggerInterface
388+
* @deprecated
389+
* @see Nothing
388390
*/
389391
private function getLogger(): LoggerInterface
390392
{
@@ -673,7 +675,7 @@ private function _getMimeType()
673675
* @param string|array $fileId
674676
* @return void
675677
* @throws \DomainException
676-
* @throws \InvalidArgumentException
678+
* @throws \InvalidArgumentException|FileSystemException
677679
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
678680
*/
679681
private function _setUploadFileId($fileId)
@@ -688,7 +690,7 @@ private function _setUploadFileId($fileId)
688690
}
689691

690692
$fileId = $fileId !== null ? $fileId : '';
691-
preg_match("/^(.*?)\[(.*?)\]$/", $fileId, $file);
693+
preg_match("/^(.*?)(\[.+])$/", $fileId, $file);
692694

693695
if (is_array($file) && count($file) > 0 && !empty($file[0]) && !empty($file[1])) {
694696
array_shift($file);
@@ -698,7 +700,14 @@ private function _setUploadFileId($fileId)
698700
$tmpVar = [];
699701

700702
foreach ($fileAttributes as $attributeName => $attributeValue) {
701-
$tmpVar[$attributeName] = $attributeValue[$file[1]];
703+
$keys = explode('][', trim($file[1], '[]'));
704+
foreach ($keys as $key) {
705+
$key = trim($key, '[]');
706+
if (isset($attributeValue[$key])) {
707+
$attributeValue = $attributeValue[$key];
708+
}
709+
}
710+
$tmpVar[$attributeName] = $attributeValue;
702711
}
703712

704713
$fileAttributes = $tmpVar;
@@ -831,6 +840,7 @@ public static function getNewFileName($destinationFile)
831840
* @param string $fileName
832841
* @return string
833842
* @deprecated 101.0.4
843+
* @see Nothing
834844
*/
835845
public static function getDispretionPath($fileName)
836846
{
@@ -864,8 +874,9 @@ public static function getDispersionPath($fileName)
864874
/**
865875
* Get driver for file
866876
*
867-
* @deprecated
868877
* @return DriverInterface
878+
* @deprecated
879+
* @see Nothing
869880
*/
870881
private function getFileDriver(): DriverInterface
871882
{

0 commit comments

Comments
 (0)