Commit 67ad08fd authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '241875-Replace-v-html' into 'master'

Replace v-html with v-safe-html in groups_dropdown_filter.vue

See merge request gitlab-org/gitlab!41212
parents defd7958 03e19cc8
<script> <script>
/* eslint-disable vue/no-v-html */ import { debounce } from 'lodash';
import { escape, debounce } from 'lodash';
import { import {
GlIcon, GlIcon,
GlLoadingIcon, GlLoadingIcon,
...@@ -9,6 +8,7 @@ import { ...@@ -9,6 +8,7 @@ import {
GlNewDropdownHeader as GlDropdownHeader, GlNewDropdownHeader as GlDropdownHeader,
GlNewDropdownItem as GlDropdownItem, GlNewDropdownItem as GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
GlSafeHtmlDirective as SafeHtml,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import Api from '~/api'; import Api from '~/api';
...@@ -26,6 +26,9 @@ export default { ...@@ -26,6 +26,9 @@ export default {
GlDropdownItem, GlDropdownItem,
GlSearchBoxByType, GlSearchBoxByType,
}, },
directives: {
SafeHtml,
},
props: { props: {
label: { label: {
type: String, type: String,
...@@ -105,9 +108,7 @@ export default { ...@@ -105,9 +108,7 @@ export default {
const parts = fullName.split('/'); const parts = fullName.split('/');
const lastPart = parts.length - 1; const lastPart = parts.length - 1;
return parts return parts
.map((part, idx) => .map((part, idx) => (idx === lastPart ? `<strong>${part.trim()}</strong>` : part.trim()))
idx === lastPart ? `<strong>${escape(part.trim())}</strong>` : escape(part.trim()),
)
.join(' / '); .join(' / ');
}, },
}, },
...@@ -151,7 +152,10 @@ export default { ...@@ -151,7 +152,10 @@ export default {
:src="group.avatar_url" :src="group.avatar_url"
shape="rect" shape="rect"
/> />
<div class="js-group-path align-middle" v-html="formatGroupPath(group.full_name)"></div> <div
v-safe-html="formatGroupPath(group.full_name)"
class="js-group-path align-middle"
></div>
</div> </div>
</gl-dropdown-item> </gl-dropdown-item>
<gl-dropdown-item v-show="noResultsAvailable" class="gl-pointer-events-none text-secondary">{{ <gl-dropdown-item v-show="noResultsAvailable" class="gl-pointer-events-none text-secondary">{{
......
---
title: Replace v-html with v-safe-html in groups_dropdown_filter.vue
merge_request: 41212
author: Kev @KevSlashNull
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment