xpgo/obsidian-folder-note-plugin

[BUG] regex includes image resize modifiers

DanArcherOnline opened this issue · 1 comments

The Problem

The regex below includes image resize modifiers.

let regexImg2 = new RegExp('!\\[\\[(.*?)\\]\\]');

I don't know the official name, but an image resize modifier is when you prefix |<new image width> to a markdown image link.

In my case, the I am using ![[Pasted image 20220602231944.png|300]] to make my image 300px wide.
I often do this to stop the images from taking up huge amounts of space.

imageUrl is being set to my/assets/path/Pasted image 20220602231944.png|300, but this is not the correct path because it contains the image resize modifier.
You can see the encoded characters after the .png in the screenshot below

image

Possible Solution

remove the image resize modifier text (\|\d+) before assigning to imageUrl

i've got the same issue, i'm using cover hsmall as a resize modifier and the plugin is searching the filelisting forthe full img.png|cover hsmall rather than img.png:
image