From 114abb7ee797755e59207481d3cfd29d309bb069 Mon Sep 17 00:00:00 2001 From: Lex Toumbourou Date: Tue, 11 Apr 2023 20:02:25 +1000 Subject: [PATCH] Fix bug causing broken links to be unescaped. --- main.ts | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index 2327709..d06a2ad 100644 --- a/main.ts +++ b/main.ts @@ -73,8 +73,8 @@ export default class BetterMarkdownLinksPlugin extends Plugin { const newFileContent = fileContent.replace( /\[(.*?)\]\((.*?)\)/g, (_, linkText, linkUrl) => { - linkUrl = decodeURIComponent(linkUrl); - if (path.basename(linkUrl) === path.basename(oldPath)) { + const linkUrlDecoded = decodeURIComponent(linkUrl); + if (path.basename(linkUrlDecoded) === path.basename(oldPath)) { const normedLink = this.normalizePathForLink( file.path, // @ts-ignore diff --git a/manifest.json b/manifest.json index 2b142a2..b3d58bd 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-title-as-link-text", "name": "Title As Link Text", - "version": "1.0.3", + "version": "1.0.4", "minAppVersion": "0.15.0", "description": "This plugin improves the behaviour of Markdown-style links in Obsidian.", "author": "Lex Toumbourou",