dy-sh / obsidian-consistent-attachments-and-links

Obsidian plugin. Move note with attachments.
MIT License
242 stars 26 forks source link

Convert All Embed Paths to Relative breaks image links #98

Closed severdia closed 3 months ago

severdia commented 3 months ago

I had some issues running "Reorganize Vault" so I decided to take each step individually to troubleshoot. I was able to "Replace All Wiki Links with Markdown Links" as the first step and it appears successful. But when I use "Convert All Embed Paths to Relative", many links break because there's an assumption that the attachments are always in the same folder as the note. Here's a before & after example:

Screenshot 2024-08-12 at 8 12 25 AM

The note linking to these images is in a subfolder of "Hiring" and it looks like the plugin is just removing the part of the absolute URL before "attachments" instead of actually checking the hierarchy of the note in relation to the image. Which, of course, results in this:

Screenshot 2024-08-12 at 8 09 34 AM

Here's what that note looks like after running "Replace All Wiki Links with Markdown Links" before running "Convert All Embed Paths to Relative".

Screenshot 2024-08-12 at 8 22 09 AM

The absolute links are correct, but the relative ones aren't.

severdia commented 3 months ago

I figured out why this was happening. It's because the New Link Format setting was set to "Absolute path in vault". Changing this to "Relative path to file" fixed the issue. Maybe there should be a notice in the readme or somewhere in the plugin to check this if it's required?

mnaoumov commented 3 months ago

@severdia no, that was a bug, fixed in https://github.com/dy-sh/obsidian-consistent-attachments-and-links/releases/tag/3.11.0