Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))}`;
}

/**
Expand Down