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

Obsidian plugin. Move note with attachments.
MIT License
202 stars 20 forks source link

Plugin does not work - it moves attachments properly, but it doesn't update the links in the note #84

Open sbsamarski opened 4 months ago

sbsamarski commented 4 months ago

I haven't used this plugin before, so I don't know if it worked before or not. But right now, if I move a note from folder A to folder B, the plugin accurately creates a new resource folder in the B folder and moves attachments there (leaving an empty note resource folder in folder A), but it doesn't update the actual links in the note. The note ends up being broken, with missing images because of the wrong links.

Note: The original resource folder in the folder A had a different name from the actual note because the note (file) name was changed after the resource folder was created. This is the case with most of my notes because I usually change or adjust the note name as I change the note. This is not a problem normally in Obsidian, but maybe it could be the reason for the plugin not to work properly?

Could it be that the plugin assumes the resource folder exactly corresponds the note's name and it doesn't look at the actual links inside the note? I often have notes with attachments that are from several different resource folders, and the note name can change many times, so the only thing that is relevant are the actual links in the note, not the supposed resource folder name.

The plugin should change the link from "Folder A/_resources/Original first note name.resources/image name.jpg" to "Folder B/_resources/Current note name.resources/image name.jpg"

It correctly creates the new resource folder and moves the attachment files there, but no matter what I try it doesn't update the links.

If I move the note back to its original folder A, the plugin leaves the newly created resource folder in folder B untouched, and also leaves the links in the note unchanged, which is still broken. I suppose it doesn't move the resource folder from folder B to folder A because it wasn't referenced in the note (nothing in the note links to the new resource folder)?

After this, the resource folder in the original folder A is empty and there is a resource folder with attachments in the folder B, but the links haven't changed at all.

Actually, I just tried placing the image directly to the "_resources" folder (/_resources/image name.jpg") and link it to it in the note, and set the resource folder in the plugin to "_resources". And it "worked", but only because the link in the note didn't change, it was already relative, pointing to the main resource folder.

But then, if I put some other file with the same name in the destination resource folder before moving the note, what happens is that the plugin deletes the attachment file in the original resource folder and does NOT copy it anywhere. It leaves the existing attachment file in the resource folder with the same name unchanged, but doesn't copy or rename the attachment file it should had moved at all. It just deletes it. That's not good.

The links are all proper markdown and Obsidian option for updating was turned off. All the plugin options are turned on except the experimental caching, which I tried both on and off. I tried entering the resource folder as "_resource", "_resource/${filename}" and also as "_resource/${filename}.resources" (which is what Obsidian normally uses). The plugin correctly created the new resource folders to designated names and moved the attachments there, but in the end, no matter what I tried the plugin doesn't update the links in the note.

sbsamarski commented 4 months ago

I'll just add something that is more of my opinion. The requirement to keep the Obsidian automatic link update option off makes this plugin practically unusable. It is just too much hassle to have to click no to Obsidian's popup to update links, every single time one does any note operation.

The plugin also asks not to use wikilinks, which is, in my and many others' opinion, more practical system than the old traditional markdown links (it's much simpler and faster to write and use). And from what I see on various forums, reddit, Youtube and everywhere else on internet, almost everyone now uses wikilinks, and not the old traditional markdown links.

So, what I want to say - it would be GREAT if this plugin would support wikilinks as well, or at the very least be made compatible with the Obsidian automatic link updating option. That option is basically the core function of the app, and Obsidian obviously doesn't like to keep it off.

gabrielbacha commented 3 months ago

Yes it doesn't work anymore.. there are 3 issues here discussion the same point. Moving, renaming, all works, but the links inside the .md notes are not getting updated

luckman212 commented 1 month ago

Hope one of these is updated soon. @trganda's plugin is now a little bit broken too with 1.6.0 (I forked and made a patch though)

eemq commented 1 month ago

https://github.com/dy-sh/obsidian-consistent-attachments-and-links/issues/83

Are these issues related? See my post above with error messages. Images move to correct location. The only issue here is that the links are not getting updated within the note. I have to manually re-link them, not ideal :)

trganda commented 1 month ago

It is just too much hassle to have to click no to Obsidian's popup to update links, every single time one does any note operation.

Hi @sbsamarski, you have to enable the option Automatically update internal links in Obsidian, the README.md was outdate and need to be update.

So, what I want to say - it would be GREAT if this plugin would support wikilinks as well

And, of course the wikilink was supported by this plugin, here is my configuration of Obsidian

image

The configuration of plugin

image

I was tested on Obsidian v1.5.12, it's work for me.

https://github.com/dy-sh/obsidian-consistent-attachments-and-links/assets/62204882/e04af025-10ba-4cc8-9107-b459a056d013

SergeiAK commented 4 weeks ago

What version of plugin do you use? I have not this fields in the latest version: Attachment format and date format And, i also confirm that links doesn't update. Plugin version 1.3.0 Obsidian 1.6.3