Skip to content

Commit 60be0b5

Browse files
committed
fix: Decode HTML entities in team display names
Added a method to decode HTML entities for display names in the picker labels. Signed-off-by: acress1 <[email protected]>
1 parent 8e69a54 commit 60be0b5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/components/MemberList/MemberList.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
v-if="showPicker"
4343
ref="entityPicker"
4444
v-model:selection="pickerSelection"
45-
:confirm-label="t('contacts', 'Add to {team}', { team: circle.displayName })"
46-
:title-label="t('contacts', 'Invite members to {team}', { team: circle.displayName })"
45+
:confirm-label="t('contacts', 'Add to {team}', { team: decodedTeamName })"
46+
:title-label="t('contacts', 'Invite members to {team}', { team: decodedTeamName })"
4747
:data-types="pickerTypes"
4848
:data-set="filteredPickerData"
4949
:internal-search="false"
@@ -116,6 +116,17 @@ export default defineComponent({
116116
return this.$store.getters.getCircle(this.selectedCircle)
117117
},
118118
119+
// Decode HTML entities in the circle display name so apostrophes (') and other
120+
// HTML-encoded chars (e.g. &#39;) are shown correctly in the picker labels.
121+
decodedTeamName(): string {
122+
const raw = this.circle && this.circle.displayName ? this.circle.displayName : ''
123+
// Use a DOM textarea element to decode HTML entities safely.
124+
// This works for common entities such as &amp;, &lt;, &gt;, &#39;, etc.
125+
const ta = document.createElement('textarea')
126+
ta.innerHTML = raw
127+
return ta.value
128+
},
129+
119130
filteredPickerData() {
120131
return this.pickerData.filter((entity) => {
121132
const type = SHARES_TYPES_MEMBER_MAP[entity.shareType]

0 commit comments

Comments
 (0)