Skip to content

Commit c859072

Browse files
committed
Merge remote-tracking branch 'origin/MC-41351' into 2.4-develop-pr142
2 parents 7aed4cd + 1bfccfa commit c859072

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/code/Magento/Customer/Model/Metadata/Form/File.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ public function compactValue($value)
320320
}
321321

322322
// Remove outdated file (in the case of file uploader UI component)
323-
if (!empty($this->_value) && !empty($value['delete'])) {
323+
if (!empty($this->_value)
324+
&& (!empty($value['delete'])
325+
|| ($this->_entityTypeCode == 'customer' && empty($value)))
326+
) {
324327
$this->fileProcessor->removeUploadedFile($this->_value);
325328
return $value;
326329
}

app/code/Magento/Customer/Test/Unit/Model/Metadata/Form/FileTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ public function testCompactValueNoDelete()
393393
->with('value')
394394
->willReturnSelf();
395395

396-
$this->assertSame('value', $model->compactValue([]));
396+
$this->assertSame([], $model->compactValue([]));
397397
}
398398

399399
public function testCompactValueDelete()
@@ -625,7 +625,7 @@ public function testCompactValueRemoveUiComponentValue()
625625
->with($value)
626626
->willReturnSelf();
627627

628-
$this->assertEquals($value, $model->compactValue([]));
628+
$this->assertEquals([], $model->compactValue([]));
629629
}
630630

631631
public function testCompactValueNoAction()

0 commit comments

Comments
 (0)