Commit d12e63eb authored by Denys Mishunov's avatar Denys Mishunov

Merge branch 'leipert-remove-unneccessary-aliasing' into 'master'

Remove unnecessary aliasing of escape and unescape

See merge request gitlab-org/gitlab!30044
parents 598bd960 628cc3c8
...@@ -6,7 +6,7 @@ import { ...@@ -6,7 +6,7 @@ import {
GlModal, GlModal,
GlModalDirective, GlModalDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ToggleButton from '~/vue_shared/components/toggle_button.vue'; import ToggleButton from '~/vue_shared/components/toggle_button.vue';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
'AlertService|%{linkStart}Learn more%{linkEnd} about configuring this endpoint to receive alerts.', 'AlertService|%{linkStart}Learn more%{linkEnd} about configuring this endpoint to receive alerts.',
), ),
{ {
linkStart: `<a href="${esc( linkStart: `<a href="${escape(
this.learnMoreUrl, this.learnMoreUrl,
)}" target="_blank" rel="noopener noreferrer">`, )}" target="_blank" rel="noopener noreferrer">`,
linkEnd: '</a>', linkEnd: '</a>',
......
/* eslint-disable class-methods-use-this */ /* eslint-disable class-methods-use-this */
import { Mark } from 'tiptap'; import { Mark } from 'tiptap';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter // Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class InlineHTML extends Mark { export default class InlineHTML extends Mark {
...@@ -35,7 +35,7 @@ export default class InlineHTML extends Mark { ...@@ -35,7 +35,7 @@ export default class InlineHTML extends Mark {
mixable: true, mixable: true,
open(state, mark) { open(state, mark) {
return `<${mark.attrs.tag}${ return `<${mark.attrs.tag}${
mark.attrs.title ? ` title="${state.esc(esc(mark.attrs.title))}"` : '' mark.attrs.title ? ` title="${state.esc(escape(mark.attrs.title))}"` : ''
}>`; }>`;
}, },
close(state, mark) { close(state, mark) {
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import axios from '../lib/utils/axios_utils'; import axios from '../lib/utils/axios_utils';
import { s__ } from '../locale'; import { s__ } from '../locale';
import Flash from '../flash'; import Flash from '../flash';
...@@ -10,7 +10,7 @@ function generateErrorBoxContent(errors) { ...@@ -10,7 +10,7 @@ function generateErrorBoxContent(errors) {
const errorList = [].concat(errors).map( const errorList = [].concat(errors).map(
errorString => ` errorString => `
<li> <li>
${esc(errorString)} ${escape(errorString)}
</li> </li>
`, `,
); );
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import helmInstallIllustration from '@gitlab/svgs/dist/illustrations/kubernetes-installation.svg'; import helmInstallIllustration from '@gitlab/svgs/dist/illustrations/kubernetes-installation.svg';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import elasticsearchLogo from 'images/cluster_app_logos/elasticsearch.png'; import elasticsearchLogo from 'images/cluster_app_logos/elasticsearch.png';
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
}, },
ingressDescription() { ingressDescription() {
return sprintf( return sprintf(
esc( escape(
s__( s__(
`ClusterIntegration|Installing Ingress may incur additional costs. Learn more about %{pricingLink}.`, `ClusterIntegration|Installing Ingress may incur additional costs. Learn more about %{pricingLink}.`,
), ),
...@@ -146,14 +146,14 @@ export default { ...@@ -146,14 +146,14 @@ export default {
{ {
pricingLink: `<a href="https://cloud.google.com/compute/pricing#lb" pricingLink: `<a href="https://cloud.google.com/compute/pricing#lb"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|pricing'))}</a>`, ${escape(s__('ClusterIntegration|pricing'))}</a>`,
}, },
false, false,
); );
}, },
certManagerDescription() { certManagerDescription() {
return sprintf( return sprintf(
esc( escape(
s__( s__(
`ClusterIntegration|Cert-Manager is a native Kubernetes certificate management controller that helps with issuing certificates. `ClusterIntegration|Cert-Manager is a native Kubernetes certificate management controller that helps with issuing certificates.
Installing Cert-Manager on your cluster will issue a certificate by %{letsEncrypt} and ensure that certificates Installing Cert-Manager on your cluster will issue a certificate by %{letsEncrypt} and ensure that certificates
...@@ -163,14 +163,14 @@ export default { ...@@ -163,14 +163,14 @@ export default {
{ {
letsEncrypt: `<a href="https://letsencrypt.org/" letsEncrypt: `<a href="https://letsencrypt.org/"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer">
${esc(s__("ClusterIntegration|Let's Encrypt"))}</a>`, ${escape(s__("ClusterIntegration|Let's Encrypt"))}</a>`,
}, },
false, false,
); );
}, },
crossplaneDescription() { crossplaneDescription() {
return sprintf( return sprintf(
esc( escape(
s__( s__(
`ClusterIntegration|Crossplane enables declarative provisioning of managed services from your cloud of choice using %{kubectl} or %{gitlabIntegrationLink}. `ClusterIntegration|Crossplane enables declarative provisioning of managed services from your cloud of choice using %{kubectl} or %{gitlabIntegrationLink}.
Crossplane runs inside your Kubernetes cluster and supports secure connectivity and secrets management between app containers and the cloud services they depend on.`, Crossplane runs inside your Kubernetes cluster and supports secure connectivity and secrets management between app containers and the cloud services they depend on.`,
...@@ -179,7 +179,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -179,7 +179,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
{ {
gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ee/user/clusters/applications.html#crossplane" gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ee/user/clusters/applications.html#crossplane"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|Gitlab Integration'))}</a>`, ${escape(s__('ClusterIntegration|Gitlab Integration'))}</a>`,
kubectl: `<code>kubectl</code>`, kubectl: `<code>kubectl</code>`,
}, },
false, false,
...@@ -188,7 +188,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -188,7 +188,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
prometheusDescription() { prometheusDescription() {
return sprintf( return sprintf(
esc( escape(
s__( s__(
`ClusterIntegration|Prometheus is an open-source monitoring system `ClusterIntegration|Prometheus is an open-source monitoring system
with %{gitlabIntegrationLink} to monitor deployed applications.`, with %{gitlabIntegrationLink} to monitor deployed applications.`,
...@@ -197,7 +197,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -197,7 +197,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
{ {
gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ce/user/project/integrations/prometheus.html" gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ce/user/project/integrations/prometheus.html"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer">
${esc(s__('ClusterIntegration|GitLab Integration'))}</a>`, ${escape(s__('ClusterIntegration|GitLab Integration'))}</a>`,
}, },
false, false,
); );
...@@ -223,11 +223,11 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -223,11 +223,11 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
installedVia() { installedVia() {
if (this.cloudRun) { if (this.cloudRun) {
return sprintf( return sprintf(
esc(s__(`ClusterIntegration|installed via %{installed_via}`)), escape(s__(`ClusterIntegration|installed via %{installed_via}`)),
{ {
installed_via: `<a href="${ installed_via: `<a href="${
this.cloudRunHelpPath this.cloudRunHelpPath
}" target="_blank" rel="noopener noreferrer">${esc( }" target="_blank" rel="noopener noreferrer">${escape(
s__('ClusterIntegration|Cloud Run'), s__('ClusterIntegration|Cloud Run'),
)}</a>`, )}</a>`,
}, },
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { s__, __ } from '../../locale'; import { s__, __ } from '../../locale';
import { APPLICATION_STATUS, INGRESS, LOGGING_MODE, BLOCKING_MODE } from '~/clusters/constants'; import { APPLICATION_STATUS, INGRESS, LOGGING_MODE, BLOCKING_MODE } from '~/clusters/constants';
import { import {
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
); );
}, },
ingressModSecurityDescription() { ingressModSecurityDescription() {
return esc(this.ingressModSecurityHelpPath); return escape(this.ingressModSecurityHelpPath);
}, },
saving() { saving() {
return [UPDATING].includes(this.ingress.status); return [UPDATING].includes(this.ingress.status);
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import SplitButton from '~/vue_shared/components/split_button.vue'; import SplitButton from '~/vue_shared/components/split_button.vue';
import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui'; import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
) )
: s__('ClusterIntegration|To remove your integration, type %{clusterName} to confirm:'), : s__('ClusterIntegration|To remove your integration, type %{clusterName} to confirm:'),
{ {
clusterName: `<code>${esc(this.clusterName)}</code>`, clusterName: `<code>${escape(this.clusterName)}</code>`,
}, },
false, false,
); );
......
<script> <script>
import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex'; import { createNamespacedHelpers, mapState, mapActions, mapGetters } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlFormInput, GlFormCheckbox } from '@gitlab/ui'; import { GlFormInput, GlFormCheckbox } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import ClusterFormDropdown from '~/create_cluster/components/cluster_form_dropdown.vue'; import ClusterFormDropdown from '~/create_cluster/components/cluster_form_dropdown.vue';
...@@ -137,7 +137,7 @@ export default { ...@@ -137,7 +137,7 @@ export default {
: s__('ClusterIntegration|Create Kubernetes cluster'); : s__('ClusterIntegration|Create Kubernetes cluster');
}, },
kubernetesIntegrationHelpText() { kubernetesIntegrationHelpText() {
const escapedUrl = esc(this.kubernetesIntegrationHelpPath); const escapedUrl = escape(this.kubernetesIntegrationHelpPath);
return sprintf( return sprintf(
s__( s__(
...@@ -256,7 +256,7 @@ export default { ...@@ -256,7 +256,7 @@ export default {
); );
}, },
gitlabManagedHelpText() { gitlabManagedHelpText() {
const escapedUrl = esc(this.gitlabManagedClusterHelpPath); const escapedUrl = escape(this.gitlabManagedClusterHelpPath);
return sprintf( return sprintf(
s__( s__(
......
<script> <script>
import { GlFormInput } from '@gitlab/ui'; import { GlFormInput } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { sprintf, s__, __ } from '~/locale'; import { sprintf, s__, __ } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
: s__('ClusterIntegration|Authenticate with AWS'); : s__('ClusterIntegration|Authenticate with AWS');
}, },
accountAndExternalIdsHelpText() { accountAndExternalIdsHelpText() {
const escapedUrl = esc(this.accountAndExternalIdsHelpPath); const escapedUrl = escape(this.accountAndExternalIdsHelpPath);
return sprintf( return sprintf(
s__( s__(
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
); );
}, },
provisionRoleArnHelpText() { provisionRoleArnHelpText() {
const escapedUrl = esc(this.createRoleArnHelpPath); const escapedUrl = escape(this.createRoleArnHelpPath);
return sprintf( return sprintf(
s__( s__(
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapState, mapGetters, mapActions } from 'vuex'; import { mapState, mapGetters, mapActions } from 'vuex';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
s__(message), s__(message),
{ {
docsLinkEnd: '&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>', docsLinkEnd: '&nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>',
docsLinkStart: `<a href="${esc( docsLinkStart: `<a href="${escape(
this.docsUrl, this.docsUrl,
)}" target="_blank" rel="noopener noreferrer">`, )}" target="_blank" rel="noopener noreferrer">`,
}, },
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import '~/gl_dropdown'; import '~/gl_dropdown';
export default class CreateItemDropdown { export default class CreateItemDropdown {
...@@ -37,14 +37,14 @@ export default class CreateItemDropdown { ...@@ -37,14 +37,14 @@ export default class CreateItemDropdown {
}, },
selectable: true, selectable: true,
toggleLabel(selected) { toggleLabel(selected) {
return selected && 'id' in selected ? esc(selected.title) : this.defaultToggleLabel; return selected && 'id' in selected ? escape(selected.title) : this.defaultToggleLabel;
}, },
fieldName: this.fieldName, fieldName: this.fieldName,
text(item) { text(item) {
return esc(item.text); return escape(item.text);
}, },
id(item) { id(item) {
return esc(item.id); return escape(item.id);
}, },
onFilter: this.toggleCreateNewButton.bind(this), onFilter: this.toggleCreateNewButton.bind(this),
clicked: options => { clicked: options => {
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import createFlash from '~/flash'; import createFlash from '~/flash';
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
return sprintf( return sprintf(
__('You can %{linkStart}view the blob%{linkEnd} instead.'), __('You can %{linkStart}view the blob%{linkEnd} instead.'),
{ {
linkStart: `<a href="${esc(this.file.view_path)}">`, linkStart: `<a href="${escape(this.file.view_path)}">`,
linkEnd: '</a>', linkEnd: '</a>',
}, },
false, false,
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import { GlDeprecatedButton, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui'; import { GlDeprecatedButton, GlTooltipDirective, GlLoadingIcon } from '@gitlab/ui';
import { polyfillSticky } from '~/lib/utils/sticky'; import { polyfillSticky } from '~/lib/utils/sticky';
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
return this.expanded ? 'chevron-down' : 'chevron-right'; return this.expanded ? 'chevron-down' : 'chevron-right';
}, },
viewFileButtonText() { viewFileButtonText() {
const truncatedContentSha = esc(truncateSha(this.diffFile.content_sha)); const truncatedContentSha = escape(truncateSha(this.diffFile.content_sha));
return sprintf( return sprintf(
s__('MergeRequests|View file @ %{commitId}'), s__('MergeRequests|View file @ %{commitId}'),
{ commitId: truncatedContentSha }, { commitId: truncatedContentSha },
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
); );
}, },
viewReplacedFileButtonText() { viewReplacedFileButtonText() {
const truncatedBaseSha = esc(truncateSha(this.diffFile.diff_refs.base_sha)); const truncatedBaseSha = escape(truncateSha(this.diffFile.diff_refs.base_sha));
return sprintf( return sprintf(
s__('MergeRequests|View replaced file @ %{commitId}'), s__('MergeRequests|View replaced file @ %{commitId}'),
{ {
......
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlDeprecatedButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -24,8 +24,8 @@ export default { ...@@ -24,8 +24,8 @@ export default {
{ {
ref_start: '<span class="ref-name">', ref_start: '<span class="ref-name">',
ref_end: '</span>', ref_end: '</span>',
source_branch: esc(this.getNoteableData.source_branch), source_branch: escape(this.getNoteableData.source_branch),
target_branch: esc(this.getNoteableData.target_branch), target_branch: escape(this.getNoteableData.target_branch),
}, },
false, false,
); );
......
import $ from 'jquery'; import $ from 'jquery';
import Dropzone from 'dropzone'; import Dropzone from 'dropzone';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import './behaviors/preview_markdown'; import './behaviors/preview_markdown';
import PasteMarkdownTable from './behaviors/markdown/paste_markdown_table'; import PasteMarkdownTable from './behaviors/markdown/paste_markdown_table';
import csrf from './lib/utils/csrf'; import csrf from './lib/utils/csrf';
...@@ -233,7 +233,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { ...@@ -233,7 +233,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
}; };
addFileToForm = path => { addFileToForm = path => {
$(form).append(`<input type="hidden" name="files[]" value="${esc(path)}">`); $(form).append(`<input type="hidden" name="files[]" value="${escape(path)}">`);
}; };
const showSpinner = () => $uploadingProgressContainer.removeClass('hide'); const showSpinner = () => $uploadingProgressContainer.removeClass('hide');
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Render modal to confirm rollback/redeploy. * Render modal to confirm rollback/redeploy.
*/ */
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlModal } from '@gitlab/ui'; import { GlModal } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
: s__('Environments|Rollback environment %{name}?'); : s__('Environments|Rollback environment %{name}?');
return sprintf(title, { return sprintf(title, {
name: esc(this.environment.name), name: escape(this.environment.name),
}); });
}, },
...@@ -50,10 +50,10 @@ export default { ...@@ -50,10 +50,10 @@ export default {
}, },
modalText() { modalText() {
const linkStart = `<a class="commit-sha mr-0" href="${esc(this.commitUrl)}">`; const linkStart = `<a class="commit-sha mr-0" href="${escape(this.commitUrl)}">`;
const commitId = esc(this.commitShortSha); const commitId = escape(this.commitShortSha);
const linkEnd = '</a>'; const linkEnd = '</a>';
const name = esc(this.name); const name = escape(this.name);
const body = this.environment.isLastDeployment const body = this.environment.isLastDeployment
? s__( ? s__(
'Environments|This action will relaunch the job for commit %{linkStart}%{commitId}%{linkEnd}, putting the environment in a previous version. Are you sure you want to continue?', 'Environments|This action will relaunch the job for commit %{linkStart}%{commitId}%{linkEnd}, putting the environment in a previous version. Are you sure you want to continue?',
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlTooltip } from '@gitlab/ui'; import { GlTooltip } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
? sprintf( ? sprintf(
__(`%{spanStart}in%{spanEnd} %{errorFn}`), __(`%{spanStart}in%{spanEnd} %{errorFn}`),
{ {
errorFn: `<strong>${esc(this.errorFn)}</strong>`, errorFn: `<strong>${escape(this.errorFn)}</strong>`,
spanStart: `<span class="text-tertiary">`, spanStart: `<span class="text-tertiary">`,
spanEnd: `</span>`, spanEnd: `</span>`,
}, },
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { USER_TOKEN_TYPES } from 'ee_else_ce/filtered_search/constants'; import { USER_TOKEN_TYPES } from 'ee_else_ce/filtered_search/constants';
import FilteredSearchContainer from '~/filtered_search/container'; import FilteredSearchContainer from '~/filtered_search/container';
import FilteredSearchVisualTokens from '~/filtered_search/filtered_search_visual_tokens'; import FilteredSearchVisualTokens from '~/filtered_search/filtered_search_visual_tokens';
...@@ -48,7 +48,7 @@ export default class VisualTokenValue { ...@@ -48,7 +48,7 @@ export default class VisualTokenValue {
tokenValueContainer.dataset.originalValue = tokenValue; tokenValueContainer.dataset.originalValue = tokenValue;
tokenValueElement.innerHTML = ` tokenValueElement.innerHTML = `
<img class="avatar s20" src="${user.avatar_url}" alt=""> <img class="avatar s20" src="${user.avatar_url}" alt="">
${esc(user.name)} ${escape(user.name)}
`; `;
/* eslint-enable no-param-reassign */ /* eslint-enable no-param-reassign */
}) })
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { spriteIcon } from './lib/utils/common_utils'; import { spriteIcon } from './lib/utils/common_utils';
const FLASH_TYPES = { const FLASH_TYPES = {
...@@ -39,14 +39,14 @@ const createAction = config => ` ...@@ -39,14 +39,14 @@ const createAction = config => `
class="flash-action" class="flash-action"
${config.href ? '' : 'role="button"'} ${config.href ? '' : 'role="button"'}
> >
${esc(config.title)} ${escape(config.title)}
</a> </a>
`; `;
const createFlashEl = (message, type) => ` const createFlashEl = (message, type) => `
<div class="flash-${type}"> <div class="flash-${type}">
<div class="flash-text"> <div class="flash-text">
${esc(message)} ${escape(message)}
<div class="close-icon-wrapper js-close-icon"> <div class="close-icon-wrapper js-close-icon">
${spriteIcon('close', 'close-icon')} ${spriteIcon('close', 'close-icon')}
</div> </div>
......
import $ from 'jquery'; import $ from 'jquery';
import '@gitlab/at.js'; import '@gitlab/at.js';
import { escape as esc, template } from 'lodash'; import { escape, template } from 'lodash';
import SidebarMediator from '~/sidebar/sidebar_mediator'; import SidebarMediator from '~/sidebar/sidebar_mediator';
import glRegexp from './lib/utils/regexp'; import glRegexp from './lib/utils/regexp';
import AjaxCache from './lib/utils/ajax_cache'; import AjaxCache from './lib/utils/ajax_cache';
...@@ -692,14 +692,14 @@ GfmAutoComplete.Emoji = { ...@@ -692,14 +692,14 @@ GfmAutoComplete.Emoji = {
// Team Members // Team Members
GfmAutoComplete.Members = { GfmAutoComplete.Members = {
templateFunction({ avatarTag, username, title, icon }) { templateFunction({ avatarTag, username, title, icon }) {
return `<li>${avatarTag} ${username} <small>${esc(title)}</small> ${icon}</li>`; return `<li>${avatarTag} ${username} <small>${escape(title)}</small> ${icon}</li>`;
}, },
}; };
GfmAutoComplete.Labels = { GfmAutoComplete.Labels = {
templateFunction(color, title) { templateFunction(color, title) {
return `<li><span class="dropdown-label-box" style="background: ${esc(color)}"></span> ${esc( return `<li><span class="dropdown-label-box" style="background: ${escape(
title, color,
)}</li>`; )}"></span> ${escape(title)}</li>`;
}, },
}; };
// Issues, MergeRequests and Snippets // Issues, MergeRequests and Snippets
...@@ -709,13 +709,13 @@ GfmAutoComplete.Issues = { ...@@ -709,13 +709,13 @@ GfmAutoComplete.Issues = {
return value.reference || '${atwho-at}${id}'; return value.reference || '${atwho-at}${id}';
}, },
templateFunction({ id, title, reference }) { templateFunction({ id, title, reference }) {
return `<li><small>${reference || id}</small> ${esc(title)}</li>`; return `<li><small>${reference || id}</small> ${escape(title)}</li>`;
}, },
}; };
// Milestones // Milestones
GfmAutoComplete.Milestones = { GfmAutoComplete.Milestones = {
templateFunction(title) { templateFunction(title) {
return `<li>${esc(title)}</li>`; return `<li>${escape(title)}</li>`;
}, },
}; };
GfmAutoComplete.Loading = { GfmAutoComplete.Loading = {
......
/* eslint-disable max-classes-per-file, one-var, consistent-return */ /* eslint-disable max-classes-per-file, one-var, consistent-return */
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import fuzzaldrinPlus from 'fuzzaldrin-plus'; import fuzzaldrinPlus from 'fuzzaldrin-plus';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import { visitUrl } from './lib/utils/url_utility'; import { visitUrl } from './lib/utils/url_utility';
...@@ -610,7 +610,7 @@ class GitLabDropdown { ...@@ -610,7 +610,7 @@ class GitLabDropdown {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
highlightTemplate(text, template) { highlightTemplate(text, template) {
return `"<b>${esc(text)}</b>" ${template}`; return `"<b>${escape(text)}</b>" ${template}`;
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapState, mapGetters, createNamespacedHelpers } from 'vuex'; import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import consts from '../../stores/modules/commit/constants'; import consts from '../../stores/modules/commit/constants';
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
commitToCurrentBranchText() { commitToCurrentBranchText() {
return sprintf( return sprintf(
s__('IDE|Commit to %{branchName} branch'), s__('IDE|Commit to %{branchName} branch'),
{ branchName: `<strong class="monospace">${esc(this.currentBranchId)}</strong>` }, { branchName: `<strong class="monospace">${escape(this.currentBranchId)}</strong>` },
false, false,
); );
}, },
......
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { sprintf, __ } from '../../../locale'; import { sprintf, __ } from '../../../locale';
import Icon from '../../../vue_shared/components/icon.vue'; import Icon from '../../../vue_shared/components/icon.vue';
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
return sprintf( return sprintf(
__('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'), __('You can test your .gitlab-ci.yml in %{linkStart}CI Lint%{linkEnd}.'),
{ {
linkStart: `<a href="${esc(this.currentProject.web_url)}/-/ci/lint">`, linkStart: `<a href="${escape(this.currentProject.web_url)}/-/ci/lint">`,
linkEnd: '</a>', linkEnd: '</a>',
}, },
false, false,
......
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import flash from '~/flash'; import flash from '~/flash';
...@@ -296,7 +296,7 @@ export const getBranchData = ({ commit, state }, { projectId, branchId, force = ...@@ -296,7 +296,7 @@ export const getBranchData = ({ commit, state }, { projectId, branchId, force =
sprintf( sprintf(
__('Branch not loaded - %{branchId}'), __('Branch not loaded - %{branchId}'),
{ {
branchId: `<strong>${esc(projectId)}/${esc(branchId)}</strong>`, branchId: `<strong>${escape(projectId)}/${escape(branchId)}</strong>`,
}, },
false, false,
), ),
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import flash from '~/flash'; import flash from '~/flash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import service from '../../services'; import service from '../../services';
...@@ -73,7 +73,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => { ...@@ -73,7 +73,7 @@ export const showBranchNotFoundError = ({ dispatch }, branchId) => {
text: sprintf( text: sprintf(
__("Branch %{branchName} was not found in this project's repository."), __("Branch %{branchName} was not found in this project's repository."),
{ {
branchName: `<strong>${esc(branchId)}</strong>`, branchName: `<strong>${escape(branchId)}</strong>`,
}, },
false, false,
), ),
...@@ -162,7 +162,7 @@ export const openBranch = ({ dispatch }, { projectId, branchId, basePath }) => { ...@@ -162,7 +162,7 @@ export const openBranch = ({ dispatch }, { projectId, branchId, basePath }) => {
sprintf( sprintf(
__('An error occurred while getting files for - %{branchId}'), __('An error occurred while getting files for - %{branchId}'),
{ {
branchId: `<strong>${esc(projectId)}/${esc(branchId)}</strong>`, branchId: `<strong>${escape(projectId)}/${escape(branchId)}</strong>`,
}, },
false, false,
), ),
......
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from './locale'; import { __, sprintf } from './locale';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import flash from './flash'; import flash from './flash';
...@@ -73,9 +73,9 @@ class ImporterStatus { ...@@ -73,9 +73,9 @@ class ImporterStatus {
const connectingVerb = this.ciCdOnly ? __('connecting') : __('importing'); const connectingVerb = this.ciCdOnly ? __('connecting') : __('importing');
job.find('.import-actions').html( job.find('.import-actions').html(
sprintf( sprintf(
esc(__('%{loadingIcon} Started')), escape(__('%{loadingIcon} Started')),
{ {
loadingIcon: `<i class="fa fa-spinner fa-spin" aria-label="${esc( loadingIcon: `<i class="fa fa-spinner fa-spin" aria-label="${escape(
connectingVerb, connectingVerb,
)}"></i>`, )}"></i>`,
}, },
......
<script> <script>
import { escape as esc, isEmpty } from 'lodash'; import { escape, isEmpty } from 'lodash';
import CiIcon from '~/vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import { sprintf, __ } from '../../locale'; import { sprintf, __ } from '../../locale';
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
'%{startLink}%{name}%{endLink}', '%{startLink}%{name}%{endLink}',
{ {
startLink: `<a href="${this.deploymentStatus.environment.environment_path}" class="js-environment-link">`, startLink: `<a href="${this.deploymentStatus.environment.environment_path}" class="js-environment-link">`,
name: esc(this.deploymentStatus.environment.name), name: escape(this.deploymentStatus.environment.name),
endLink: '</a>', endLink: '</a>',
}, },
false, false,
...@@ -74,8 +74,8 @@ export default { ...@@ -74,8 +74,8 @@ export default {
} }
const { name, path } = this.deploymentCluster; const { name, path } = this.deploymentCluster;
const escapedName = esc(name); const escapedName = escape(name);
const escapedPath = esc(path); const escapedPath = escape(path);
if (!escapedPath) { if (!escapedPath) {
return escapedName; return escapedName;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* global ListLabel */ /* global ListLabel */
import $ from 'jquery'; import $ from 'jquery';
import { isEqual, escape as esc, sortBy, template } from 'lodash'; import { isEqual, escape, sortBy, template } from 'lodash';
import { sprintf, s__, __ } from './locale'; import { sprintf, s__, __ } from './locale';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions'; import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
...@@ -269,7 +269,7 @@ export default class LabelsSelect { ...@@ -269,7 +269,7 @@ export default class LabelsSelect {
} }
linkEl.className = selectedClass.join(' '); linkEl.className = selectedClass.join(' ');
linkEl.innerHTML = `${colorEl} ${esc(label.title)}`; linkEl.innerHTML = `${colorEl} ${escape(label.title)}`;
const listItemEl = document.createElement('li'); const listItemEl = document.createElement('li');
listItemEl.appendChild(linkEl); listItemEl.appendChild(linkEl);
...@@ -557,7 +557,7 @@ export default class LabelsSelect { ...@@ -557,7 +557,7 @@ export default class LabelsSelect {
scopedLabelTemplate, scopedLabelTemplate,
tooltipTitleTemplate, tooltipTitleTemplate,
isScopedLabel, isScopedLabel,
escapeStr: esc, escapeStr: escape,
}); });
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* global ListMilestone */ /* global ListMilestone */
import $ from 'jquery'; import $ from 'jquery';
import { template, escape as esc } from 'lodash'; import { template, escape } from 'lodash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import '~/gl_dropdown'; import '~/gl_dropdown';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
...@@ -106,12 +106,12 @@ export default class MilestoneSelect { ...@@ -106,12 +106,12 @@ export default class MilestoneSelect {
if (showMenuAbove) { if (showMenuAbove) {
$dropdown.data('glDropdown').positionMenuAbove(); $dropdown.data('glDropdown').positionMenuAbove();
} }
$(`[data-milestone-id="${esc(selectedMilestone)}"] > a`).addClass('is-active'); $(`[data-milestone-id="${escape(selectedMilestone)}"] > a`).addClass('is-active');
}), }),
renderRow: milestone => ` renderRow: milestone => `
<li data-milestone-id="${esc(milestone.name)}"> <li data-milestone-id="${escape(milestone.name)}">
<a href='#' class='dropdown-menu-milestone-link'> <a href='#' class='dropdown-menu-milestone-link'>
${esc(milestone.title)} ${escape(milestone.title)}
</a> </a>
</li> </li>
`, `,
...@@ -129,7 +129,7 @@ export default class MilestoneSelect { ...@@ -129,7 +129,7 @@ export default class MilestoneSelect {
}, },
defaultLabel, defaultLabel,
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
text: milestone => esc(milestone.title), text: milestone => escape(milestone.title),
id: milestone => { id: milestone => {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) { if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
return milestone.name; return milestone.name;
...@@ -148,7 +148,7 @@ export default class MilestoneSelect { ...@@ -148,7 +148,7 @@ export default class MilestoneSelect {
selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault; selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault;
} }
$('a.is-active', $el).removeClass('is-active'); $('a.is-active', $el).removeClass('is-active');
$(`[data-milestone-id="${esc(selectedMilestone)}"] > a`, $el).addClass('is-active'); $(`[data-milestone-id="${escape(selectedMilestone)}"] > a`, $el).addClass('is-active');
}, },
vue: $dropdown.hasClass('js-issue-board-sidebar'), vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: clickEvent => { clicked: clickEvent => {
......
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash'; import Flash from '~/flash';
...@@ -161,7 +161,7 @@ export default class SSHMirror { ...@@ -161,7 +161,7 @@ export default class SSHMirror {
const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list'); const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list');
let fingerprints = ''; let fingerprints = '';
sshHostKeys.fingerprints.forEach(fingerprint => { sshHostKeys.fingerprints.forEach(fingerprint => {
const escFingerprints = esc(fingerprint.fingerprint); const escFingerprints = escape(fingerprint.fingerprint);
fingerprints += `<code>${escFingerprints}</code>`; fingerprints += `<code>${escFingerprints}</code>`;
}); });
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue'; import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
return sprintf( return sprintf(
s__('AdminProjects|Delete Project %{projectName}?'), s__('AdminProjects|Delete Project %{projectName}?'),
{ {
projectName: `'${esc(this.projectName)}'`, projectName: `'${escape(this.projectName)}'`,
}, },
false, false,
); );
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
and all related resources including issues, merge requests, etc.. Once you confirm and press and all related resources including issues, merge requests, etc.. Once you confirm and press
%{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`), %{strong_start}Delete project%{strong_end}, it cannot be undone or recovered.`),
{ {
projectName: `<strong>${esc(this.projectName)}</strong>`, projectName: `<strong>${escape(this.projectName)}</strong>`,
strong_start: '<strong>', strong_start: '<strong>',
strong_end: '</strong>', strong_end: '</strong>',
}, },
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
return sprintf( return sprintf(
s__('AdminUsers|To confirm, type %{projectName}'), s__('AdminUsers|To confirm, type %{projectName}'),
{ {
projectName: `<code>${esc(this.projectName)}</code>`, projectName: `<code>${escape(this.projectName)}</code>`,
}, },
false, false,
); );
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui'; import { GlModal, GlDeprecatedButton, GlFormInput } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
return sprintf( return sprintf(
this.content, this.content,
{ {
username: `<strong>${esc(this.username)}</strong>`, username: `<strong>${escape(this.username)}</strong>`,
strong_start: '<strong>', strong_start: '<strong>',
strong_end: '</strong>', strong_end: '</strong>',
}, },
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
return sprintf( return sprintf(
s__('AdminUsers|To confirm, type %{username}'), s__('AdminUsers|To confirm, type %{username}'),
{ {
username: `<code>${esc(this.username)}</code>`, username: `<code>${escape(this.username)}</code>`,
}, },
false, false,
); );
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash'; import createFlash from '~/flash';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
const label = `<span const label = `<span
class="label color-label" class="label color-label"
style="background-color: ${this.labelColor}; color: ${this.labelTextColor};" style="background-color: ${this.labelColor}; color: ${this.labelTextColor};"
>${esc(this.labelTitle)}</span>`; >${escape(this.labelTitle)}</span>`;
return sprintf( return sprintf(
s__('Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>'), s__('Labels|<span>Promote label</span> %{labelTitle} <span>to Group Label?</span>'),
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlModal, GlModalDirective } from '@gitlab/ui'; import { GlModal, GlModalDirective } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
return sprintf( return sprintf(
s__('WikiPageConfirmDelete|Delete page %{pageTitle}?'), s__('WikiPageConfirmDelete|Delete page %{pageTitle}?'),
{ {
pageTitle: esc(this.pageTitle), pageTitle: escape(this.pageTitle),
}, },
false, false,
); );
......
<script> <script>
import { isEmpty, escape as esc } from 'lodash'; import { isEmpty, escape } from 'lodash';
import stageColumnMixin from '../../mixins/stage_column_mixin'; import stageColumnMixin from '../../mixins/stage_column_mixin';
import JobItem from './job_item.vue'; import JobItem from './job_item.vue';
import JobGroupDropdown from './job_group_dropdown.vue'; import JobGroupDropdown from './job_group_dropdown.vue';
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
}, },
methods: { methods: {
groupId(group) { groupId(group) {
return `ci-badge-${esc(group.name)}`; return `ci-badge-${escape(group.name)}`;
}, },
pipelineActionRequestComplete() { pipelineActionRequestComplete() {
this.$emit('refreshPipelineGraph'); this.$emit('refreshPipelineGraph');
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -43,10 +43,10 @@ You are going to change the username %{currentUsernameBold} to %{newUsernameBold ...@@ -43,10 +43,10 @@ You are going to change the username %{currentUsernameBold} to %{newUsernameBold
Profile and projects will be redirected to the %{newUsername} namespace but this redirect will expire once the %{currentUsername} namespace is registered by another user or group. Profile and projects will be redirected to the %{newUsername} namespace but this redirect will expire once the %{currentUsername} namespace is registered by another user or group.
Please update your Git repository remotes as soon as possible.`), Please update your Git repository remotes as soon as possible.`),
{ {
currentUsernameBold: `<strong>${esc(this.username)}</strong>`, currentUsernameBold: `<strong>${escape(this.username)}</strong>`,
newUsernameBold: `<strong>${esc(this.newUsername)}</strong>`, newUsernameBold: `<strong>${escape(this.newUsername)}</strong>`,
currentUsername: esc(this.username), currentUsername: escape(this.username),
newUsername: esc(this.newUsername), newUsername: escape(this.newUsername),
}, },
false, false,
); );
......
<script> <script>
import { mapState, mapActions, mapGetters } from 'vuex'; import { mapState, mapActions, mapGetters } from 'vuex';
import { GlButton, GlFormInput, GlFormGroup } from '@gitlab/ui'; import { GlButton, GlFormInput, GlFormGroup } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import MarkdownField from '~/vue_shared/components/markdown/field.vue'; import MarkdownField from '~/vue_shared/components/markdown/field.vue';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow'; import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
'Changing a Release tag is only supported via Releases API. %{linkStart}More information%{linkEnd}', 'Changing a Release tag is only supported via Releases API. %{linkStart}More information%{linkEnd}',
), ),
{ {
linkStart: `<a href="${esc( linkStart: `<a href="${escape(
this.updateReleaseApiDocsPath, this.updateReleaseApiDocsPath,
)}" target="_blank" rel="noopener noreferrer">`, )}" target="_blank" rel="noopener noreferrer">`,
linkEnd: '</a>', linkEnd: '</a>',
......
/* eslint-disable no-return-assign, consistent-return, class-methods-use-this */ /* eslint-disable no-return-assign, consistent-return, class-methods-use-this */
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc, throttle } from 'lodash'; import { escape, throttle } from 'lodash';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper'; import { getIdenticonBackgroundClass, getIdenticonTitle } from '~/helpers/avatar_helper';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
...@@ -448,7 +448,7 @@ export class SearchAutocomplete { ...@@ -448,7 +448,7 @@ export class SearchAutocomplete {
const avatar = avatarUrl const avatar = avatarUrl
? `<img class="search-item-avatar" src="${avatarUrl}" />` ? `<img class="search-item-avatar" src="${avatarUrl}" />`
: `<div class="s16 avatar identicon ${getIdenticonBackgroundClass(id)}">${getIdenticonTitle( : `<div class="s16 avatar identicon ${getIdenticonBackgroundClass(id)}">${getIdenticonTitle(
esc(label), escape(label),
)}</div>`; )}</div>`;
return avatar; return avatar;
......
import $ from 'jquery'; import $ from 'jquery';
import '~/gl_dropdown'; import '~/gl_dropdown';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __ } from '~/locale'; import { __ } from '~/locale';
function isValidProjectId(id) { function isValidProjectId(id) {
...@@ -49,7 +49,7 @@ class SidebarMoveIssue { ...@@ -49,7 +49,7 @@ class SidebarMoveIssue {
renderRow: project => ` renderRow: project => `
<li> <li>
<a href="#" class="js-move-issue-dropdown-item"> <a href="#" class="js-move-issue-dropdown-item">
${esc(project.name_with_namespace)} ${escape(project.name_with_namespace)}
</a> </a>
</li> </li>
`, `,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* global emitSidebarEvent */ /* global emitSidebarEvent */
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc, template, uniqBy } from 'lodash'; import { escape, template, uniqBy } from 'lodash';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import { s__, __, sprintf } from './locale'; import { s__, __, sprintf } from './locale';
import ModalStore from './boards/stores/modal_store'; import ModalStore from './boards/stores/modal_store';
...@@ -205,7 +205,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -205,7 +205,7 @@ function UsersSelect(currentUser, els, options = {}) {
username: data.assignee.username, username: data.assignee.username,
avatar: data.assignee.avatar_url, avatar: data.assignee.avatar_url,
}; };
tooltipTitle = esc(user.name); tooltipTitle = escape(user.name);
} else { } else {
user = { user = {
name: s__('UsersSelect|Unassigned'), name: s__('UsersSelect|Unassigned'),
...@@ -543,7 +543,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -543,7 +543,7 @@ function UsersSelect(currentUser, els, options = {}) {
let img = ''; let img = '';
if (user.beforeDivider != null) { if (user.beforeDivider != null) {
`<li><a href='#' class='${selected === true ? 'is-active' : ''}'>${esc( `<li><a href='#' class='${selected === true ? 'is-active' : ''}'>${escape(
user.name, user.name,
)}</a></li>`; )}</a></li>`;
} else { } else {
...@@ -672,10 +672,10 @@ UsersSelect.prototype.formatResult = function(user) { ...@@ -672,10 +672,10 @@ UsersSelect.prototype.formatResult = function(user) {
</div> </div>
<div class='user-info'> <div class='user-info'>
<div class='user-name dropdown-menu-user-full-name'> <div class='user-name dropdown-menu-user-full-name'>
${esc(user.name)} ${escape(user.name)}
</div> </div>
<div class='user-username dropdown-menu-user-username text-secondary'> <div class='user-username dropdown-menu-user-username text-secondary'>
${!user.invite ? `@${esc(user.username)}` : ''} ${!user.invite ? `@${escape(user.username)}` : ''}
</div> </div>
</div> </div>
</div> </div>
...@@ -683,7 +683,7 @@ UsersSelect.prototype.formatResult = function(user) { ...@@ -683,7 +683,7 @@ UsersSelect.prototype.formatResult = function(user) {
}; };
UsersSelect.prototype.formatSelection = function(user) { UsersSelect.prototype.formatSelection = function(user) {
return esc(user.name); return escape(user.name);
}; };
UsersSelect.prototype.user = function(user_id, callback) { UsersSelect.prototype.user = function(user_id, callback) {
...@@ -746,7 +746,7 @@ UsersSelect.prototype.renderRow = function(issuableType, user, selected, usernam ...@@ -746,7 +746,7 @@ UsersSelect.prototype.renderRow = function(issuableType, user, selected, usernam
${this.renderRowAvatar(issuableType, user, img)} ${this.renderRowAvatar(issuableType, user, img)}
<span class="d-flex flex-column overflow-hidden"> <span class="d-flex flex-column overflow-hidden">
<strong class="dropdown-menu-user-full-name"> <strong class="dropdown-menu-user-full-name">
${esc(user.name)} ${escape(user.name)}
</strong> </strong>
${username ? `<span class="dropdown-menu-user-username">${username}</span>` : ''} ${username ? `<span class="dropdown-menu-user-username">${username}</span>` : ''}
</span> </span>
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { n__, s__, sprintf } from '~/locale'; import { n__, s__, sprintf } from '~/locale';
import { mergeUrlParams, webIDEUrl } from '~/lib/utils/url_utility'; import { mergeUrlParams, webIDEUrl } from '~/lib/utils/url_utility';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
'mrWidget|The source branch is %{commitsBehindLinkStart}%{commitsBehind}%{commitsBehindLinkEnd} the target branch', 'mrWidget|The source branch is %{commitsBehindLinkStart}%{commitsBehind}%{commitsBehindLinkEnd} the target branch',
), ),
{ {
commitsBehindLinkStart: `<a href="${esc(this.mr.targetBranchPath)}">`, commitsBehindLinkStart: `<a href="${escape(this.mr.targetBranchPath)}">`,
commitsBehind: n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount), commitsBehind: n__('%d commit behind', '%d commits behind', this.mr.divergedCommitsCount),
commitsBehindLinkEnd: '</a>', commitsBehindLinkEnd: '</a>',
}, },
......
<script> <script>
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlDeprecatedButton } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, n__, sprintf, s__ } from '~/locale'; import { __, n__, sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
{ {
commitCount: `<strong class="commits-count-message">${this.commitsCountMessage}</strong>`, commitCount: `<strong class="commits-count-message">${this.commitsCountMessage}</strong>`,
mergeCommitCount: `<strong>${s__('mrWidgetCommitsAdded|1 merge commit')}</strong>`, mergeCommitCount: `<strong>${s__('mrWidgetCommitsAdded|1 merge commit')}</strong>`,
targetBranch: `<span class="label-branch">${esc(this.targetBranch)}</span>`, targetBranch: `<span class="label-branch">${escape(this.targetBranch)}</span>`,
}, },
false, false,
); );
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import { mouseenter, debouncedMouseleave, togglePopover } from '~/shared/popover'; import { mouseenter, debouncedMouseleave, togglePopover } from '~/shared/popover';
import StatusIcon from '../mr_widget_status_icon.vue'; import StatusIcon from '../mr_widget_status_icon.vue';
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
content: sprintf( content: sprintf(
s__('mrWidget|%{link_start}Learn more about resolving conflicts%{link_end}'), s__('mrWidget|%{link_start}Learn more about resolving conflicts%{link_end}'),
{ {
link_start: `<a href="${esc( link_start: `<a href="${escape(
this.mr.conflictsDocsPath, this.mr.conflictsDocsPath,
)}" target="_blank" rel="noopener noreferrer">`, )}" target="_blank" rel="noopener noreferrer">`,
link_end: '</a>', link_end: '</a>',
......
<script> <script>
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import icon from '../../../vue_shared/components/icon.vue'; import icon from '../../../vue_shared/components/icon.vue';
function buildDocsLinkStart(path) { function buildDocsLinkStart(path) {
return `<a href="${esc(path)}" target="_blank" rel="noopener noreferrer">`; return `<a href="${escape(path)}" target="_blank" rel="noopener noreferrer">`;
} }
export default { export default {
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import '~/behaviors/markdown/render_gfm'; import '~/behaviors/markdown/render_gfm';
import { unescape as unesc } from 'lodash'; import { unescape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import { stripHtml } from '~/lib/utils/text_utility'; import { stripHtml } from '~/lib/utils/text_utility';
import Flash from '../../../flash'; import Flash from '../../../flash';
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
return text; return text;
} }
return unesc(stripHtml(richText).replace(/\n/g, '')); return unescape(stripHtml(richText).replace(/\n/g, ''));
} }
return ''; return '';
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import { __, sprintf, n__ } from '~/locale'; import { __, sprintf, n__ } from '~/locale';
import { getTimeago } from '~/lib/utils/datetime_utility'; import { getTimeago } from '~/lib/utils/datetime_utility';
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
methods: { methods: {
getTimeAgoString(createdAt) { getTimeAgoString(createdAt) {
return sprintf(__('opened %{timeAgo}'), { return sprintf(__('opened %{timeAgo}'), {
timeAgo: esc(getTimeago().format(createdAt)), timeAgo: escape(getTimeago().format(createdAt)),
}); });
}, },
showReviewTime(value) { showReviewTime(value) {
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlDeprecatedButton } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -74,7 +74,7 @@ export default { ...@@ -74,7 +74,7 @@ export default {
return ` return `
<li> <li>
<a href='#' class='dropdown-menu-link is-active'> <a href='#' class='dropdown-menu-link is-active'>
${esc(stage.title)} ${escape(stage.title)}
</a> </a>
</li> </li>
`; `;
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui'; import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
const lastPart = parts.length - 1; const lastPart = parts.length - 1;
return parts return parts
.map((part, idx) => .map((part, idx) =>
idx === lastPart ? `<strong>${esc(part.trim())}</strong>` : esc(part.trim()), idx === lastPart ? `<strong>${escape(part.trim())}</strong>` : escape(part.trim()),
) )
.join(' / '); .join(' / ');
}, },
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui'; import { GlLoadingIcon, GlDeprecatedButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import { n__, s__, __ } from '~/locale'; import { n__, s__, __ } from '~/locale';
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
<li> <li>
<a href='#' class='dropdown-menu-link ${isActiveClass}'> <a href='#' class='dropdown-menu-link ${isActiveClass}'>
${this.avatarTemplate(project)} ${this.avatarTemplate(project)}
<div class="align-middle">${esc(project.name)}</div> <div class="align-middle">${escape(project.name)}</div>
</a> </a>
</li> </li>
`; `;
......
<script> <script>
import $ from 'jquery'; import $ from 'jquery';
import 'select2/select2'; import 'select2/select2';
import { escape as esc, debounce } from 'lodash'; import { escape, debounce } from 'lodash';
import Api from 'ee/api'; import Api from 'ee/api';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { TYPE_USER, TYPE_GROUP } from '../constants'; import { TYPE_USER, TYPE_GROUP } from '../constants';
...@@ -12,7 +12,7 @@ function addType(type) { ...@@ -12,7 +12,7 @@ function addType(type) {
} }
function formatSelection(group) { function formatSelection(group) {
return esc(group.full_name || group.name); return escape(group.full_name || group.name);
} }
function formatResultUser(result) { function formatResultUser(result) {
...@@ -25,8 +25,8 @@ function formatResultUser(result) { ...@@ -25,8 +25,8 @@ function formatResultUser(result) {
${avatar} ${avatar}
</div> </div>
<div class="user-info"> <div class="user-info">
<div class="user-name">${esc(name)}</div> <div class="user-name">${escape(name)}</div>
<div class="user-username">@${esc(username)}</div> <div class="user-username">@${escape(username)}</div>
</div> </div>
</div> </div>
`; `;
...@@ -42,8 +42,8 @@ function formatResultGroup(result) { ...@@ -42,8 +42,8 @@ function formatResultGroup(result) {
${avatar} ${avatar}
</div> </div>
<div class="group-info"> <div class="group-info">
<div class="group-name">${esc(fullName)}</div> <div class="group-name">${escape(fullName)}</div>
<div class="group-path">${esc(fullPath)}</div> <div class="group-path">${escape(fullPath)}</div>
</div> </div>
</div> </div>
`; `;
......
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { sprintf, n__, s__ } from '~/locale'; import { sprintf, n__, s__ } from '~/locale';
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue'; import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
'ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{nMembers}.', 'ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{nMembers}.',
), ),
{ {
name: `<strong>${esc(this.rule.name)}</strong>`, name: `<strong>${escape(this.rule.name)}</strong>`,
nMembers: `<strong>${nMembers}</strong>`, nMembers: `<strong>${nMembers}</strong>`,
}, },
false, false,
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapActions, mapState, mapGetters } from 'vuex'; import { mapActions, mapState, mapGetters } from 'vuex';
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
...mapState('subscription', ['isLoading', 'hasError', 'plan', 'tables', 'endpoint']), ...mapState('subscription', ['isLoading', 'hasError', 'plan', 'tables', 'endpoint']),
...mapGetters('subscription', ['isFreePlan']), ...mapGetters('subscription', ['isFreePlan']),
subscriptionHeader() { subscriptionHeader() {
const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : esc(this.plan.name); const planName = this.isFreePlan ? s__('SubscriptionTable|Free') : escape(this.plan.name);
const suffix = !this.isFreePlan && this.plan.trial ? s__('SubscriptionTable|Trial') : ''; const suffix = !this.isFreePlan && this.plan.trial ? s__('SubscriptionTable|Trial') : '';
return `${this.namespaceName}: ${planName} ${suffix}`; return `${this.namespaceName}: ${planName} ${suffix}`;
......
<script> <script>
import { escape as esc, isEmpty } from 'lodash'; import { escape, isEmpty } from 'lodash';
import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui'; import { GlTooltipDirective, GlLink, GlBadge } from '@gitlab/ui';
import Alerts from 'ee/vue_shared/dashboards/components/alerts.vue'; import Alerts from 'ee/vue_shared/dashboards/components/alerts.vue';
import TimeAgo from 'ee/vue_shared/dashboards/components/time_ago.vue'; import TimeAgo from 'ee/vue_shared/dashboards/components/time_ago.vue';
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
return ( return (
this.commit.author || { this.commit.author || {
avatar_url: this.commit.author_gravatar_url, avatar_url: this.commit.author_gravatar_url,
path: `mailto:${esc(this.commit.author_email)}`, path: `mailto:${escape(this.commit.author_email)}`,
username: this.commit.author_name, username: this.commit.author_name,
} }
); );
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlDeprecatedButton, GlTooltipDirective, GlModal, GlToggle } from '@gitlab/ui'; import { GlDeprecatedButton, GlTooltipDirective, GlModal, GlToggle } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -41,7 +41,7 @@ export default { ...@@ -41,7 +41,7 @@ export default {
return sprintf( return sprintf(
s__('FeatureFlags|Delete %{name}?'), s__('FeatureFlags|Delete %{name}?'),
{ {
name: esc(this.deleteFeatureFlagName), name: escape(this.deleteFeatureFlagName),
}, },
false, false,
); );
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
return sprintf( return sprintf(
s__('FeatureFlags|Feature flag %{name} will be removed. Are you sure?'), s__('FeatureFlags|Feature flag %{name} will be removed. Are you sure?'),
{ {
name: esc(this.deleteFeatureFlagName), name: escape(this.deleteFeatureFlagName),
}, },
false, false,
); );
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
...@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => { ...@@ -32,7 +32,7 @@ export const configCheckError = (status, helpUrl) => {
return sprintf( return sprintf(
ERROR_CONFIG, ERROR_CONFIG,
{ {
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`, helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
helpEnd: '</a>', helpEnd: '</a>',
}, },
false, false,
...@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl => ...@@ -48,7 +48,7 @@ export const runnersCheckEmpty = helpUrl =>
sprintf( sprintf(
EMPTY_RUNNERS, EMPTY_RUNNERS,
{ {
helpStart: `<a href="${esc(helpUrl)}" target="_blank">`, helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
helpEnd: '</a>', helpEnd: '</a>',
}, },
false, false,
......
...@@ -9,7 +9,7 @@ import { ...@@ -9,7 +9,7 @@ import {
GlEmptyState, GlEmptyState,
GlTable, GlTable,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import Tracking from '~/tracking'; import Tracking from '~/tracking';
import PackageActivity from './activity.vue'; import PackageActivity from './activity.vue';
import PackageInformation from './information.vue'; import PackageInformation from './information.vue';
...@@ -83,8 +83,8 @@ export default { ...@@ -83,8 +83,8 @@ export default {
`PackageRegistry|You are about to delete version %{boldStart}%{version}%{boldEnd} of %{boldStart}%{name}%{boldEnd}. Are you sure?`, `PackageRegistry|You are about to delete version %{boldStart}%{version}%{boldEnd} of %{boldStart}%{name}%{boldEnd}. Are you sure?`,
), ),
{ {
version: esc(this.packageEntity.version), version: escape(this.packageEntity.version),
name: esc(this.packageEntity.name), name: escape(this.packageEntity.name),
boldStart: '<b>', boldStart: '<b>',
boldEnd: '</b>', boldEnd: '</b>',
}, },
......
/* eslint-disable no-underscore-dangle, class-methods-use-this */ /* eslint-disable no-underscore-dangle, class-methods-use-this */
import { escape as esc, find, countBy } from 'lodash'; import { escape, find, countBy } from 'lodash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash'; import Flash from '~/flash';
import { n__, s__, __ } from '~/locale'; import { n__, s__, __ } from '~/locale';
...@@ -471,7 +471,7 @@ export default class AccessDropdown { ...@@ -471,7 +471,7 @@ export default class AccessDropdown {
<li> <li>
<a href="#" class="${isActiveClass}"> <a href="#" class="${isActiveClass}">
<img src="${user.avatar_url}" class="avatar avatar-inline" width="30"> <img src="${user.avatar_url}" class="avatar avatar-inline" width="30">
<strong class="dropdown-menu-user-full-name">${esc(user.name)}</strong> <strong class="dropdown-menu-user-full-name">${escape(user.name)}</strong>
<span class="dropdown-menu-user-username">${user.username}</span> <span class="dropdown-menu-user-username">${user.username}</span>
</a> </a>
</li> </li>
......
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlModal } from '@gitlab/ui'; import { GlModal } from '@gitlab/ui';
...@@ -30,13 +30,13 @@ export default { ...@@ -30,13 +30,13 @@ export default {
if (this.removeItemType === ChildType.Epic) { if (this.removeItemType === ChildType.Epic) {
Object.assign(sprintfParams, { Object.assign(sprintfParams, {
targetEpicTitle: esc(this.removeItemModalProps.item.title), targetEpicTitle: escape(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title), parentEpicTitle: escape(this.parentItem.title),
}); });
} else { } else {
Object.assign(sprintfParams, { Object.assign(sprintfParams, {
targetIssueTitle: esc(this.removeItemModalProps.item.title), targetIssueTitle: escape(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title), parentEpicTitle: escape(this.parentItem.title),
}); });
} }
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { import {
GlPopover, GlPopover,
GlLink, GlLink,
...@@ -68,12 +68,12 @@ export default { ...@@ -68,12 +68,12 @@ export default {
}, },
createdAt() { createdAt() {
return sprintf(__('created %{timeAgo}'), { return sprintf(__('created %{timeAgo}'), {
timeAgo: esc(getTimeago().format(this.requirement.createdAt)), timeAgo: escape(getTimeago().format(this.requirement.createdAt)),
}); });
}, },
updatedAt() { updatedAt() {
return sprintf(__('updated %{timeAgo}'), { return sprintf(__('updated %{timeAgo}'), {
timeAgo: esc(getTimeago().format(this.requirement.updatedAt)), timeAgo: escape(getTimeago().format(this.requirement.updatedAt)),
}); });
}, },
isArchived() { isArchived() {
......
<script> <script>
import { GlLoadingIcon, GlLink, GlTooltip } from '@gitlab/ui'; import { GlLoadingIcon, GlLink, GlTooltip } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
// Fallback to None if immediate parent is unavailable. // Fallback to None if immediate parent is unavailable.
let { title } = immediateParent; let { title } = immediateParent;
title = esc(title); title = escape(title);
const { humanReadableEndDate, humanReadableTimestamp } = immediateParent; const { humanReadableEndDate, humanReadableTimestamp } = immediateParent;
......
<script> <script>
import { GlModal, GlDeprecatedButton } from '@gitlab/ui'; import { GlModal, GlDeprecatedButton } from '@gitlab/ui';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
export default { export default {
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
"Merging immediately isn't recommended as it may negatively impact the existing merge train. Read the %{docsLinkStart}documentation%{docsLinkEnd} for more information.", "Merging immediately isn't recommended as it may negatively impact the existing merge train. Read the %{docsLinkStart}documentation%{docsLinkEnd} for more information.",
), ),
{ {
docsLinkStart: `<a href="${esc( docsLinkStart: `<a href="${escape(
this.docsUrl, this.docsUrl,
)}" target="_blank" rel="noopener noreferrer">`, )}" target="_blank" rel="noopener noreferrer">`,
docsLinkEnd: '</a>', docsLinkEnd: '</a>',
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
'mrWidget|This merge request will be added to the merge train when pipeline %{linkStart}#%{pipelineId}%{linkEnd} succeeds.', 'mrWidget|This merge request will be added to the merge train when pipeline %{linkStart}#%{pipelineId}%{linkEnd} succeeds.',
); );
const sanitizedPipelineLink = esc(this.pipelineLink); const sanitizedPipelineLink = escape(this.pipelineLink);
return sprintf( return sprintf(
text, text,
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { __, n__, sprintf } from '~/locale'; import { __, n__, sprintf } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -40,8 +40,8 @@ export default { ...@@ -40,8 +40,8 @@ export default {
return sprintf( return sprintf(
__('%{title} %{operator} %{threshold}'), __('%{title} %{operator} %{threshold}'),
{ {
title: esc(this.lastAlert.title), title: escape(this.lastAlert.title),
threshold: `${esc(this.lastAlert.threshold)}%`, threshold: `${escape(this.lastAlert.threshold)}%`,
operator: this.lastAlert.operator, operator: this.lastAlert.operator,
}, },
false, false,
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import { s__, sprintf } from '~/locale'; import { s__, sprintf } from '~/locale';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue'; import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
computed: { computed: {
...mapState(LICENSE_MANAGEMENT, ['currentLicenseInModal']), ...mapState(LICENSE_MANAGEMENT, ['currentLicenseInModal']),
confirmationText() { confirmationText() {
const name = `<strong>${esc(this.currentLicenseInModal.name)}</strong>`; const name = `<strong>${escape(this.currentLicenseInModal.name)}</strong>`;
return sprintf( return sprintf(
s__('LicenseCompliance|You are about to remove the license, %{name}, from this project.'), s__('LicenseCompliance|You are about to remove the license, %{name}, from this project.'),
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue'; import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { GlDeprecatedButton } from '@gitlab/ui'; import { GlDeprecatedButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
const projectLink = const projectLink =
project && project.url && project.value project && project.url && project.value
? `<a href="${esc(project.url)}">${esc(project.value)}</a>` ? `<a href="${escape(project.url)}">${escape(project.value)}</a>`
: null; : null;
if (pipelineLink && projectLink) { if (pipelineLink && projectLink) {
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue'; import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
const issueLink = `<a href="${feedback.issue_url}">#${feedback.issue_iid}</a>`; const issueLink = `<a href="${feedback.issue_url}">#${feedback.issue_iid}</a>`;
if (project && project.value && project.url) { if (project && project.value && project.url) {
const projectLink = `<a href="${esc(project.url)}">${esc(project.value)}</a>`; const projectLink = `<a href="${escape(project.url)}">${escape(project.value)}</a>`;
return sprintf( return sprintf(
__('Created issue %{issueLink} at %{projectLink}'), __('Created issue %{issueLink} at %{projectLink}'),
......
<script> <script>
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue'; import EventItem from 'ee/vue_shared/security_reports/components/event_item.vue';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
const mergeRequestLink = `<a href="${feedback.merge_request_path}">!${feedback.merge_request_iid}</a>`; const mergeRequestLink = `<a href="${feedback.merge_request_path}">!${feedback.merge_request_iid}</a>`;
if (project && project.value && project.url) { if (project && project.value && project.url) {
const projectLink = `<a href="${esc(project.url)}">${esc(project.value)}</a>`; const projectLink = `<a href="${escape(project.url)}">${escape(project.value)}</a>`;
return sprintf( return sprintf(
__('Created merge request %{mergeRequestLink} at %{projectLink}'), __('Created merge request %{mergeRequestLink} at %{projectLink}'),
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import * as messages from 'ee/ide/stores/modules/terminal/messages'; import * as messages from 'ee/ide/stores/modules/terminal/messages';
import { sprintf } from '~/locale'; import { sprintf } from '~/locale';
...@@ -15,7 +15,7 @@ describe('EE IDE store terminal messages', () => { ...@@ -15,7 +15,7 @@ describe('EE IDE store terminal messages', () => {
sprintf( sprintf(
messages.ERROR_CONFIG, messages.ERROR_CONFIG,
{ {
helpStart: `<a href="${esc(TEST_HELP_URL)}" target="_blank">`, helpStart: `<a href="${escape(TEST_HELP_URL)}" target="_blank">`,
helpEnd: '</a>', helpEnd: '</a>',
}, },
false, false,
......
import Vue from 'vue'; import Vue from 'vue';
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import ancestorsTree from 'ee/sidebar/components/ancestors_tree/ancestors_tree.vue'; import ancestorsTree from 'ee/sidebar/components/ancestors_tree/ancestors_tree.vue';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
...@@ -57,7 +57,7 @@ describe('AncestorsTreeContainer', () => { ...@@ -57,7 +57,7 @@ describe('AncestorsTreeContainer', () => {
it('escapes html in the tooltip', () => { it('escapes html in the tooltip', () => {
const title = '<script>alert(1);</script>'; const title = '<script>alert(1);</script>';
const escapedTitle = esc(title); const escapedTitle = escape(title);
vm.$props.ancestors = [{ id: 1, url: '', title, state: 'open' }]; vm.$props.ancestors = [{ id: 1, url: '', title, state: 'open' }];
......
import { escape as esc } from 'lodash'; import { escape } from 'lodash';
import VisualTokenValue from '~/filtered_search/visual_token_value'; import VisualTokenValue from '~/filtered_search/visual_token_value';
import AjaxCache from '~/lib/utils/ajax_cache'; import AjaxCache from '~/lib/utils/ajax_cache';
import UsersCache from '~/lib/utils/users_cache'; import UsersCache from '~/lib/utils/users_cache';
...@@ -121,7 +121,7 @@ describe('Filtered Search Visual Tokens', () => { ...@@ -121,7 +121,7 @@ describe('Filtered Search Visual Tokens', () => {
expect(tokenValueElement.innerText.trim()).toBe(dummyUser.name); expect(tokenValueElement.innerText.trim()).toBe(dummyUser.name);
tokenValueElement.querySelector('.avatar').remove(); tokenValueElement.querySelector('.avatar').remove();
expect(tokenValueElement.innerHTML.trim()).toBe(esc(dummyUser.name)); expect(tokenValueElement.innerHTML.trim()).toBe(escape(dummyUser.name));
}) })
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
......
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