Skip to content

Commit 9aadb1f

Browse files
committed
update broken undocumented API usage for getting the vault's path, fix #32
1 parent 1b196ea commit 9aadb1f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,9 @@ export default class CopyUrlInPreview extends Plugin {
304304
})
305305
);
306306
if (protocol === "app:" && Platform.isDesktop) {
307-
// href probably also works
308307
// getResourcePath("") also works for root path
309308
const baseFilePath = (this.app.vault.adapter as FileSystemAdapterWithInternalApi).getFilePath("");
310-
const baseFilePathName: string = (baseFilePath as any).pathname;
309+
const baseFilePathName: string = baseFilePath.replace("file://", "");
311310
const urlPathName: string = (url as any).pathname;
312311
if (urlPathName.startsWith(baseFilePathName)) {
313312
let relativePath = urlPathName.replace(baseFilePathName, "");

0 commit comments

Comments
 (0)