Commit b53f2f23 authored by Lukas Eipert's avatar Lukas Eipert

Replace deprecated `escape` with `encodeURIComponent`

`escape` is deprecated per MDN [0], we should use encodeURIComponent
instead. We do this, because we want to avoid confusion with e.g. the
actual escaping of HTML entity characters with helper functions like
`lodash.escape`.

[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/escape
parent 85f79640
......@@ -108,14 +108,14 @@ export default {
return acc.concat({
name,
path,
to: `/-/tree/${joinPaths(escape(this.ref), path)}`,
to: `/-/tree/${joinPaths(encodeURIComponent(this.ref), path)}`,
});
},
[
{
name: this.projectShortPath,
path: '/',
to: `/-/tree/${escape(this.ref)}/`,
to: `/-/tree/${encodeURIComponent(this.ref)}/`,
},
],
);
......
......@@ -28,7 +28,7 @@ export default {
return splitArray.map(p => encodeURIComponent(p)).join('/');
},
parentRoute() {
return { path: `/-/tree/${escape(this.commitRef)}/${this.parentPath}` };
return { path: `/-/tree/${encodeURIComponent(this.commitRef)}/${this.parentPath}` };
},
},
methods: {
......
......@@ -99,7 +99,7 @@ export default {
computed: {
routerLinkTo() {
return this.isFolder
? { path: `/-/tree/${escape(this.ref)}/${escapeFileUrl(this.path)}` }
? { path: `/-/tree/${encodeURIComponent(this.ref)}/${escapeFileUrl(this.path)}` }
: null;
},
isFolder() {
......
......@@ -48,7 +48,7 @@ const defaultClient = createDefaultClient(
case 'TreeEntry':
case 'Submodule':
case 'Blob':
return `${escape(obj.flatPath)}-${obj.id}`;
return `${encodeURIComponent(obj.flatPath)}-${obj.id}`;
default:
// If the type doesn't match any of the above we fallback
// to using the default Apollo ID
......
......@@ -100,7 +100,9 @@ export default function setupVueRepositoryList() {
render(h) {
return h(TreeActionLink, {
props: {
path: `${historyLink}/${this.$route.params.path ? escape(this.$route.params.path) : ''}`,
path: `${historyLink}/${
this.$route.params.path ? encodeURIComponent(this.$route.params.path) : ''
}`,
text: __('History'),
},
});
......
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