Skip to content

Commit 2383f88

Browse files
committed
Merge branch '2.4-develop' of github.com:magento/magento2 into AC-2574
2 parents fda03ee + fde5551 commit 2383f88

File tree

23 files changed

+589
-163
lines changed

23 files changed

+589
-163
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Bug report
2+
description: Technical issue with the Magento 2 core components
3+
body:
4+
- type: markdown
5+
attributes:
6+
value: |
7+
Please read [our guidelines](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#report-an-issue) before submitting the issue.
8+
- type: textarea
9+
attributes:
10+
label: Preconditions and environment
11+
description: |
12+
Describe your environment.
13+
Provide all the details that will help us to reproduce the bug.
14+
value: |
15+
- Magento version
16+
- Anything else that would help a developer reproduce the bug
17+
- type: textarea
18+
attributes:
19+
label: Steps to reproduce
20+
description: |
21+
Provide a set of clear steps to reproduce this bug.
22+
placeholder: |
23+
Example:
24+
1. Navigate to storefront as a guest.
25+
2. Open Test Category.
26+
3. Click “Add to Cart” on the Virtual Product.
27+
4. Open mini shopping cart and click “Proceed to Checkout”.
28+
validations:
29+
required: true
30+
- type: textarea
31+
attributes:
32+
label: Expected result
33+
description: |
34+
Tell us what you expected to happen.
35+
placeholder: |
36+
Example:
37+
Order is placed successfully, customer is redirected to the success page.
38+
validations:
39+
required: true
40+
- type: textarea
41+
attributes:
42+
label: Actual result
43+
description: |
44+
Tell us what happened. Include error messages and issues.
45+
placeholder: |
46+
Example:
47+
“Place order” button is not visible, order cannot be placed.
48+
validations:
49+
required: true
50+
- type: textarea
51+
attributes:
52+
label: Additional information
53+
description: |
54+
Additional information is often requested when the bug report is processed. You can save time by providing both Magento and browser logs, screenshots, repository branch and HEAD commit you checked out to install Magento and any other artifacts related to the issue.
55+
Also, links to the comments with important information, Root Cause analysis, additional video recordings; and anything else that is important for the issue and at some reason cannot be added to other sections.
56+
- type: textarea
57+
attributes:
58+
label: Release note
59+
description: |
60+
Help us to provide meaningful release notes to the community.
61+
- type: checkboxes
62+
attributes:
63+
label: Triage and priority
64+
description: |
65+
Provide [Severity](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#community-backlog-priority) assessment for the Issue as a Reporter.
66+
This information helps us during the Confirmation and Issue triage processes.
67+
options:
68+
- label: 'Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._'
69+
- label: 'Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._'
70+
- label: 'Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._'
71+
- label: 'Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._'
72+
- label: 'Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._'

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Magento values the contributions of the security research community, and we look
44

55
## Where should I report security issues?
66

7-
We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/magento). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps.
7+
We strongly encourage you to report all security issues privately via our [bug bounty program](https://hackerone.com/adobe). Please provide us with relevant technical details and repro steps to expedite our investigation. If you prefer not to use HackerOne, email us directly at `psirt@adobe.com` with details and repro steps.
88

99
## Learning More About Security
1010
To learn more about securing a Magento store, please visit the [Security Center](https://magento.com/security).

app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\AbstractProduct
4040
protected $_useLinkForAsLowAs = false;
4141

4242
/**
43-
* Customer id
44-
*
4543
* @var null|int
4644
*/
4745
protected $_customerId = null;
@@ -52,22 +50,16 @@ class ListCompare extends \Magento\Catalog\Block\Product\AbstractProduct
5250
protected $httpContext;
5351

5452
/**
55-
* Customer visitor
56-
*
5753
* @var \Magento\Customer\Model\Visitor
5854
*/
5955
protected $_customerVisitor;
6056

6157
/**
62-
* Catalog product visibility
63-
*
6458
* @var \Magento\Catalog\Model\Product\Visibility
6559
*/
6660
protected $_catalogProductVisibility;
6761

6862
/**
69-
* Item collection factory
70-
*
7163
* @var \Magento\Catalog\Model\ResourceModel\Product\Compare\Item\CollectionFactory
7264
*/
7365
protected $_itemCollectionFactory;
@@ -205,6 +197,9 @@ public function getProductAttributeValue($product, $attribute)
205197
} else {
206198
$value = $product->getData($attribute->getAttributeCode());
207199
}
200+
if (is_array($value)) {
201+
return __('N/A');
202+
}
208203
return (string)$value == '' ? __('No') : $value;
209204
}
210205

app/code/Magento/Catalog/Test/Mftf/Data/ImageContentData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@
4343
<entity name="MagentoPlaceHolderImageContent" type="ImageContent">
4444
<data key="baseImage_md5">c0459a796c5b8ee74254472c235a7460</data>
4545
</entity>
46+
<entity name="TestImageWithDotInFilenameImageContent" extends="MagentoLogoImageContent" type="ImageContent">
47+
<data key="baseImage_md5">4aa2a3c3eefd29898585a8dd781e5bfd</data>
48+
<data key="name" unique="prefix">m.agento-logo.png</data>
49+
</entity>
4650
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@
431431
<data key="file">test_image.jpg</data>
432432
<data key="filename">test_image</data>
433433
</entity>
434+
<entity name="TestImageWithDotInFilename" extends="MagentoLogo" type="image">
435+
<data key="title" unique="suffix">TestImageWithDotInFilename</data>
436+
<data key="file">m.agento-logo.png</data>
437+
<data key="filename">m.agento-logo</data>
438+
</entity>
434439
<entity name="ProductWithUnicode" type="product">
435440
<data key="name" unique="suffix">&#38657;&#20135;&#21697;</data>
436441
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontProductImageWithDotTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Product Image"/>
15+
<title value="Product image with dot in filename should be visible on frontend after catalog image cache flush"/>
16+
<description value="Product image with dot in filename should be visible on frontend after catalog image cache flush"/>
17+
<group value="Catalog"/>
18+
<severity value="AVERAGE"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set system/upload_configuration/enable_resize 0" stepKey="disableImageResizing"/>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<after>
25+
<magentoCLI command="config:set system/upload_configuration/enable_resize 1" stepKey="enableImageResizing"/>
26+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct">
27+
<argument name="sku" value="{{SimpleProduct.sku}}"/>
28+
</actionGroup>
29+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/>
30+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/>
31+
</after>
32+
33+
<!--Create product-->
34+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="openNewProductPage"/>
35+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillSimpleProductMain">
36+
<argument name="product" value="SimpleProduct"/>
37+
</actionGroup>
38+
39+
<!-- Add image to product -->
40+
<actionGroup ref="AddProductImageActionGroup" stepKey="addImageForSimpleProduct">
41+
<argument name="image" value="TestImageWithDotInFilename"/>
42+
</actionGroup>
43+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/>
44+
45+
<!-- Flush catalog image cache -->
46+
<actionGroup ref="AdminGoToCacheManagementPageActionGroup" stepKey="goToCacheManagementPage"/>
47+
<actionGroup ref="AdminClickFlushCatalogImagesCacheActionGroup" stepKey="clearCatalogImageCache"/>
48+
49+
<!-- Assert product in storefront product page -->
50+
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageActionGroup" stepKey="assertProductInStorefrontProductPage">
51+
<argument name="product" value="SimpleProduct"/>
52+
</actionGroup>
53+
54+
<!-- Assert product image in storefront product page -->
55+
<grabAttributeFrom userInput="src" selector="{{StorefrontProductMediaSection.imageFile(TestImageWithDotInFilename.filename)}}" stepKey="productImageURL"/>
56+
<helper class="Magento\Backend\Test\Mftf\Helper\CurlHelpers" method="assertImageContentIsEqual" stepKey="assertProductImageEqualToOriginalImage">
57+
<argument name="url">{$productImageURL}</argument>
58+
<argument name="expectedString">{{TestImageWithDotInFilenameImageContent.baseImage_md5}}</argument>
59+
<argument name="message">Url: "{$productImageURL}" did not render image: {{TestImageWithDotInFilename.file}}</argument>
60+
</helper>
61+
</test>
62+
</tests>

app/code/Magento/Catalog/Test/Unit/Block/Product/Compare/ListCompareTest.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use Magento\Catalog\Block\Product\Compare\ListCompare;
1111
use Magento\Catalog\Block\Product\Context;
1212
use Magento\Catalog\Model\Product;
13+
use Magento\Eav\Model\Entity\Attribute\AttributeInterface;
14+
use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend;
1315
use Magento\Framework\Pricing\Render;
1416
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1517
use Magento\Framework\View\Layout;
@@ -50,6 +52,48 @@ protected function tearDown(): void
5052
$this->block = null;
5153
}
5254

55+
/**
56+
* @dataProvider attributeDataProvider
57+
* @param array $attributeData
58+
* @param string $expectedResult
59+
*/
60+
public function testProductAttributeValue($attributeData, $expectedResult)
61+
{
62+
$attribute = $this->getMockBuilder(AttributeInterface::class)
63+
->addMethods(['getAttributeCode', 'getSourceModel', 'getFrontendInput', 'getFrontend'])
64+
->getMockForAbstractClass();
65+
$frontEndModel = $this->createPartialMock(AbstractFrontend::class, ['getValue']);
66+
$productMock = $this->createPartialMock(Product::class, ['getId', 'getData', 'hasData']);
67+
$productMock->expects($this->any())
68+
->method('hasData')
69+
->with($attributeData['attribute_code'])
70+
->willReturn(true);
71+
$productMock->expects($this->any())
72+
->method('getData')
73+
->with($attributeData['attribute_code'])
74+
->willReturn($attributeData['attribute_value']);
75+
$attribute->expects($this->any())
76+
->method('getAttributeCode')
77+
->willReturn($attributeData['attribute_code']);
78+
$attribute->expects($this->any())
79+
->method('getSourceModel')
80+
->willReturn($attributeData['source_model']);
81+
$attribute->expects($this->any())
82+
->method('getFrontendInput')
83+
->willReturn($attributeData['frontend_input']);
84+
$frontEndModel->expects($this->any())
85+
->method('getValue')
86+
->with($productMock)
87+
->willReturn($attributeData['attribute_value']);
88+
$attribute->expects($this->any())
89+
->method('getFrontend')
90+
->willReturn($frontEndModel);
91+
$this->assertEquals(
92+
$expectedResult,
93+
$this->block->getProductAttributeValue($productMock, $attribute)
94+
);
95+
}
96+
5397
public function testGetProductPrice()
5498
{
5599
//Data
@@ -84,4 +128,31 @@ public function testGetProductPrice()
84128

85129
$this->assertEquals($expectedResult, $this->block->getProductPrice($product, '-compare-list-top'));
86130
}
131+
132+
/**
133+
* @return array
134+
*/
135+
public function attributeDataProvider(): array
136+
{
137+
return [
138+
[
139+
'attributeData' => [
140+
'attribute_code' => 'tier_price',
141+
'source_model' => null,
142+
'frontend_input' => 'text',
143+
'attribute_value' => []
144+
],
145+
'expectedResult' => __('N/A')
146+
],
147+
[
148+
'attributeData' => [
149+
'attribute_code' => 'special_price',
150+
'source_model' => null,
151+
'frontend_input' => 'decimal',
152+
'attribute_value' => 50.00
153+
],
154+
'expectedResult' => '50.00'
155+
]
156+
];
157+
}
87158
}

app/code/Magento/MediaStorage/App/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private function setPlaceholderImage(): void
259259
*/
260260
private function getOriginalImage(string $resizedImagePath): string
261261
{
262-
return preg_replace('|^.*?((?:/([^/])/([^/])/\2\3)?/?[^/]+$)|', '$1', $resizedImagePath);
262+
return preg_replace('|^.*((?:/[^/]+){3})$|', '$1', $resizedImagePath);
263263
}
264264

265265
/**

0 commit comments

Comments
 (0)