This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
assets/js/base/components/review-list-item Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,15 @@ function getReviewContent( review ) {
5555function getReviewProductName ( review ) {
5656 return (
5757 < div className = "wc-block-review-list-item__product" >
58- < a href = { review . product_permalink } >
59- { review . product_name }
60- </ a >
58+ < a
59+ href = { review . product_permalink }
60+ dangerouslySetInnerHTML = { {
61+ // `product_name` might have html entities for things like
62+ // emdash. So to display properly we need to allow the
63+ // browser to render.
64+ __html : review . product_name ,
65+ } }
66+ />
6167 </ div >
6268 ) ;
6369}
@@ -128,4 +134,13 @@ ReviewListItem.propTypes = {
128134 review : PropTypes . object ,
129135} ;
130136
137+ /**
138+ * BE AWARE. ReviewListItem expects product data that is equivalent to what is
139+ * made avaialble for output in a public view. Thus content that may contain
140+ * html data is not sanitized further.
141+ *
142+ * Currently the following data is trusted (assumed to already be sanitized):
143+ * - `review.review` (review content).
144+ * - `review.product_name` (the product title)
145+ */
131146export default ReviewListItem ;
You can’t perform that action at this time.
0 commit comments