Commit 0560febf authored by Mark Florian's avatar Mark Florian

Merge branch...

Merge branch '241951-remove-v-html-from-app-assets-javascripts-diffs-components-diff_file-vue' into 'master'

Remove v-html from app/assets/javascripts/diffs/components/diff_file.vue

Closes #241951

See merge request gitlab-org/gitlab!41486
parents abac5e4d 5d852c6f
<script> <script>
/* eslint-disable vue/no-v-html */
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { escape } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -18,6 +17,9 @@ export default { ...@@ -18,6 +17,9 @@ export default {
DiffContent, DiffContent,
GlLoadingIcon, GlLoadingIcon,
}, },
directives: {
SafeHtml,
},
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
props: { props: {
file: { file: {
...@@ -182,7 +184,7 @@ export default { ...@@ -182,7 +184,7 @@ export default {
/> />
<div v-if="forkMessageVisible" class="js-file-fork-suggestion-section file-fork-suggestion"> <div v-if="forkMessageVisible" class="js-file-fork-suggestion-section file-fork-suggestion">
<span class="file-fork-suggestion-note" v-html="forkMessage"></span> <span v-safe-html="forkMessage" class="file-fork-suggestion-note"></span>
<a <a
:href="file.fork_path" :href="file.fork_path"
class="js-fork-suggestion-button btn btn-grouped btn-inverted btn-success" class="js-fork-suggestion-button btn btn-grouped btn-inverted btn-success"
...@@ -200,7 +202,7 @@ export default { ...@@ -200,7 +202,7 @@ export default {
<template v-else> <template v-else>
<div :id="`diff-content-${file.file_hash}`"> <div :id="`diff-content-${file.file_hash}`">
<div v-if="errorMessage" class="diff-viewer"> <div v-if="errorMessage" class="diff-viewer">
<div class="nothing-here-block" v-html="errorMessage"></div> <div v-safe-html="errorMessage" class="nothing-here-block"></div>
</div> </div>
<template v-else> <template v-else>
<div v-show="isCollapsed" class="nothing-here-block diff-collapsed"> <div v-show="isCollapsed" class="nothing-here-block diff-collapsed">
......
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