xpgo / obsidian-folder-note-plugin

Plugin to add description note to a folder for Obsidian.
385 stars 27 forks source link

[BUG] regex includes image resize modifiers #60

Open DanArcherOnline opened 2 years ago

DanArcherOnline commented 2 years ago

The Problem

The regex below includes image resize modifiers.

https://github.com/xpgo/obsidian-folder-note-plugin/blob/272bbdc9a674fd333e6a97b02611868797648585/src/folder-brief.ts#L160

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

Proshyak commented 1 year ago

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