From 50ff43bdd4e481d16bf23378626a5c63dcd92eab Mon Sep 17 00:00:00 2001 From: Alex Phillips Date: Mon, 29 Apr 2019 22:42:49 -0400 Subject: [PATCH] fix (#159): attempting to fix url encoding for filename URLs * attempting to fix url encoding for filename URLs * handle the case where percent sign exists in the filename / dirname * remove the try/catch as this shouldn't be necessary, changed logic for url encoding links that doesn't involve looping --- client/helpers/navigate.js | 2 +- client/pages/filespage/thing-existing.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/helpers/navigate.js b/client/helpers/navigate.js index feb6df28..a520ff48 100644 --- a/client/helpers/navigate.js +++ b/client/helpers/navigate.js @@ -38,7 +38,7 @@ function encode_path(path){ } export function prepare(path){ - return encodeURIComponent(decodeURIComponent(path)); // to send our url correctly without using directly '/' + return encodeURIComponent(decodeURIComponent(path.replace(/%/g, '%25'))); } export function urlParams() { diff --git a/client/pages/filespage/thing-existing.js b/client/pages/filespage/thing-existing.js index 9397b6f1..db1a323f 100644 --- a/client/pages/filespage/thing-existing.js +++ b/client/pages/filespage/thing-existing.js @@ -241,9 +241,11 @@ export class ExistingThing extends React.Component { } className = className.trim(); + let encodedLink = encodeURIComponent(this.props.file.link).replace(/%2F/g, '/'); + return connectDragSource(connectDropNativeFile(connectDropFile(
- +