I’d like to report the same issue as reported by @sararkin at Vault.rename(file, path) is not updating existing links - Bug graveyard - Obsidian Forum.
Since the moderator suggest the bug should belongs to API sections. I’d like to report here again.
My system and obsidian version is different from sararkin, but the problem remains.
Steps to reproduce
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
const newPath = "hoge.md";
Renames file and updates all links, same behavior as just renaming manually
Renames the file, The vault.on(“rename”) event is indeed triggered. But existing links aren’t updated to point to the new file
- Operating system: Windows 10
- Obsidian version: v0.13.23
This is the API you should use for rename and update links:
Thanks a lot, I have verified the API with
this.app.fileManager.renameFile(this.app.vault.getAbstractFileByPath("abc/abc.md"), "abc/abc2.md"), it works perfectly!