From 76e21d1c56934928eff8b234930b5e915e861392 Mon Sep 17 00:00:00 2001 From: mineclover Date: Wed, 4 Jan 2023 15:52:39 +0900 Subject: [PATCH] feat : spaceEncode, to make it look better. --- main.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index def93e6..b7d2092 100644 --- a/main.ts +++ b/main.ts @@ -268,6 +268,9 @@ export default class Waypoint extends Plugin { return null; } + spaceEncode(str: string) { + return str.replace(/ /g, "%20"); + } /** * Generate an encoded URI path to the given file that is relative to the given root. * @param rootNode The from which the relative path will be generated @@ -276,9 +279,9 @@ export default class Waypoint extends Plugin { */ getEncodedUri(rootNode: TFolder, node: TAbstractFile) { if (rootNode.isRoot()) { - return `./${encodeURI(node.path)}`; + return `./${this.spaceEncode(node.path)}`; } - return `./${encodeURI(node.path.substring(rootNode.path.length + 1))}`; + return `./${this.spaceEncode(node.path.substring(rootNode.path.length + 1))}`; } /**