-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue product name in minicart render wrong with special characters #29794
Fix issue product name in minicart render wrong with special characters #29794
Conversation
Hi @mrtuvn. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
16bd6c5
to
32b520c
Compare
@magento run all tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrtuvn could you fix the failing static tests?
@ihor-sviziev just find out this rule in validate code magento
That is reason of the fail static test |
Need your opinions ! @lbajsarowicz @lenaorobei @sivaschenko |
@mrtuvn I believe we need to ignore these cases as we have html there for sure |
What should i do on this ? Not only the product name, still other place in this file fail static test magento2/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html Line 48 in 32b520c
This line will violation static rule magento about html sanitize |
The risk was set to |
@mrtuvn please see https://devdocs.magento.com/guides/v2.4/extension-dev-guide/xss-protection.html about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrtuvn from what @engcom-Charlie shown above - seems like we need to change the variable name from product_name
to productNameUnsanitizedHtml
, revert change that was done in https://github.com/magento/magento2/pull/13802/files#diff-6502b94b418435d6341605ae8a37b46fR88 and add new variable productNameUnsanitizedHtml
instead.
Could you do that?
yes i can do that but seem need more effort that still have other variable like options this value seem previously passed validator check |
@mrtuvn can we move it to some method? I believe if that method will be named correctly - it should not complain. Seems to me that this check was just added quite recently |
32b520c
to
388c12e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just analyzed this HTML one time ago - seems like option.value in cases that you changed should contain already escaped html, so it should come from backend.
I would suggest just to remove escaping on frontend and add comment that it should be already escaped on backend.
As result we'll just fix the issue with product_name and will not change anything related to option.value.
What do you thing?
app/code/Magento/Checkout/view/frontend/web/js/view/cart-item-renderer.js
Outdated
Show resolved
Hide resolved
app/code/Magento/Checkout/view/frontend/web/js/view/cart-item-renderer.js
Outdated
Show resolved
Hide resolved
update update update update up up up update up Update default.html fix getProductNameUnsanitizedHtml is not defined up
7f108a6
to
9df9db2
Compare
@magento run all tests |
Hi @ihor-sviziev, thank you for the review. |
✔️ QA Passed Manual testing scenario:
Before: ✖️ incorrectly renderer product name in the cart After: ✔️ correctly rendered product name in the cart |
Hi @mrtuvn, thank you for your contribution! |
Description (*)
With product has url magento render name without problem. But in the case product without url will render product name in cart incorrectly. Ex: product with special characters like double quotes
This fix will cover the case products don't have url and render name correctly
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
I have one question need clarify about knockout
In template inside foreach loop when use $parent for reference to component i can't call to method that i have defined But if i used $parents[1] its work to call method! Any reason behind this ? i don't see any doc mention in magento official devdocs
Is that knockout context changed inside loop foreach ?
CC: @ihor-sviziev @omiroshnichenko @guz-anton
Contribution checklist (*)