diff options
author | Corentin Mors <corentin.mors@dashlane.com> | 2020-10-23 18:31:08 +0300 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-11-15 11:37:27 +0300 |
commit | 8c8dd2b3f3f649de1f4a89b5e77a0cda4ab3b62b (patch) | |
tree | 7df29902c1adeac9abf0a9fde9f5c47ec981296b /src | |
parent | dfff9d8a6733537ddf2fa69f72052b43ebe81f62 (diff) |
Fix %2F bug in folder paths
Signed-off-by: Corentin Mors <corentin.mors@dashlane.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/FolderTagPreview.vue | 2 | ||||
-rw-r--r-- | src/router/index.js | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/components/FolderTagPreview.vue b/src/components/FolderTagPreview.vue index 35919538..faef4330 100644 --- a/src/components/FolderTagPreview.vue +++ b/src/components/FolderTagPreview.vue @@ -128,7 +128,7 @@ export default { // apply to current route return Object.assign({}, this.$route, { - params: { path }, + params: { path: path.split('/') }, }) }, }, diff --git a/src/router/index.js b/src/router/index.js index 6fc04aa7..93ae68bb 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -38,6 +38,16 @@ if (!isMapsInstalled) { mapsPath = generateUrl('/settings/apps/integration/maps') } +/** + * Parse the path of a route : join the elements of the array and return a single string with slashes + * + always lead current path with a slash + * @param {string|array} path path arguments to parse + * @returns {string} + */ +const parsePathParams = (path) => { + return `/${Array.isArray(path) ? path.join('/') : path || ''}` +} + export default new Router({ mode: 'history', // if index.php is in the url AND we got this far, then it's working: @@ -58,8 +68,7 @@ export default new Router({ component: Albums, name: 'albums', props: route => ({ - // always lead current path with a slash - path: `/${route.params.path ? route.params.path : ''}`, + path: parsePathParams(route.params.path), // if path is empty isRoot: !route.params.path, rootTitle: t('photos', 'Your folders'), @@ -70,8 +79,7 @@ export default new Router({ component: Albums, name: 'shared', props: route => ({ - // always lead current path with a slash - path: `/${route.params.path ? route.params.path : ''}`, + path: parsePathParams(route.params.path), // if path is empty isRoot: !route.params.path, rootTitle: t('photos', 'Shared with you'), |