web/satellite: encode file browser URL components

File paths may contain characters that have special meaning when placed
in URLs. For example, a folder name may contain a pound symbol (#)
which is the URL fragment delimiter. This causes the characters that
succeed this symbol to not be considered part of the primary resource
identifier as they should be, resulting in navigation errors.
This change resolves this issue.

Resolves #5522

Change-Id: I59972321795375ec5981c3e9c505e35f998022d6
This commit is contained in:
Jeremy Wharton 2023-01-31 13:59:21 -06:00 committed by Storj Robot
parent 5377b9c314
commit 33bd929308

View File

@ -161,7 +161,8 @@ const dropdownOpen = computed((): boolean => {
*/
const link = computed((): string => {
const browserRoot = store.state.files.browserRoot;
const pathAndKey = store.state.files.path + props.file.Key;
const uriParts = (store.state.files.path + props.file.Key).split('/');
const pathAndKey = uriParts.map(part => encodeURIComponent(part)).join('/');
return pathAndKey.length > 0
? browserRoot + pathAndKey + '/'
: browserRoot;