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