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))}`; } /**