From 3c7aa92fb0e0402dccb9fde7457a45b749182545 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Tue, 3 Mar 2020 14:50:16 +0100 Subject: [PATCH] Better encoding of collectionPath in the URL. --- frontend/src/js/component/wb-collection-content.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/js/component/wb-collection-content.js b/frontend/src/js/component/wb-collection-content.js index aa1cda4..7c0d301 100644 --- a/frontend/src/js/component/wb-collection-content.js +++ b/frontend/src/js/component/wb-collection-content.js @@ -11,6 +11,10 @@ function unescapeName(name) { (_, $1) => ($1 === '\\\\' ? '\\' : String.fromCharCode(parseInt($1.substr(1), 8)))); } +function encodeURIComponentIncludingDots(s) { + return encodeURIComponent(s).replace('.', '%2E'); +} + class WBCollectionContent extends Component { constructor(...args) { super(...args); @@ -26,7 +30,7 @@ class WBCollectionContent extends Component { getUrl(params) { let res = '/collection-browse/' + ('uuid' in params ? params.uuid : this.props.uuid) + '/' + - encodeURIComponent('collectionPath' in params ? params.collectionPath : this.props.collectionPath) + '/' + + encodeURIComponentIncludingDots('collectionPath' in params ? params.collectionPath : this.props.collectionPath) + '/' + ('page' in params ? params.page : this.props.page); return res; }