Skip to content

Commit 2b95196

Browse files
committed
B2B-2061: Validation for files(image) fails while not saving the remote storage file on local FS
1 parent 9a8ed48 commit 2b95196

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidateFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*/
1414
class ValidateFactory
1515
{
16+
/**
17+
* @var ObjectManagerInterface
18+
*/
1619
private ObjectManagerInterface $objectManager;
1720

1821
/**
@@ -26,7 +29,7 @@ public function __construct(ObjectManagerInterface $objectManager)
2629
/**
2730
* Main factory method
2831
*
29-
* @return \Zend_Validate
32+
* @return ExistingValidate
3033
*/
3134
public function create()
3235
{

app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ protected function parseExtensionsString($extensions)
133133
}
134134

135135
/**
136+
* Adds required validators to th $object
137+
*
136138
* @param \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object
137139
* @param \Magento\Catalog\Model\Product\Option $option
138140
* @param array $fileFullPath

app/code/Magento/RemoteStorage/Plugin/ExistingValidate.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(
7171
* Copies file from the remote server to the tmp directory
7272
*
7373
* @param Subject $subject
74-
* @param $value
74+
* @param string $value
7575
* @param string|null $originalName
7676
* @return array
7777
* @throws FileSystemException
@@ -116,6 +116,7 @@ private function copyFileToTmp(string $filePath): string
116116
$absolutePath = $this->remoteDirectoryWrite->getAbsolutePath($filePath);
117117
if ($this->remoteDirectoryWrite->isFile($absolutePath)) {
118118
$this->tmpDirectoryWrite->create();
119+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
119120
$tmpPath = $this->tmpDirectoryWrite->getAbsolutePath() . basename($filePath);
120121
$content = $this->remoteDirectoryWrite->getDriver()->fileGetContents($filePath);
121122
if ($this->tmpDirectoryWrite->getDriver()->filePutContents($tmpPath, $content) >= 0) {

0 commit comments

Comments
 (0)