Attachment ids no longer match between notes and Joplin

Hi everyone, due to some difficulties with a plugin, I have 8000 attachments that are no longer linked to my notes. Specifically, for images with the format ![filename](:/attachment-id), the filenames are consistent but the attachment-ids are wrong now.

Obviously, this is pretty stressful and annoying since 2+ years of notes and 8000+ different attachments were affected. I am specifically interested in knowing things like:

  • is there a way to systematically replace attachment ids in existing notes
  • is there a way to rollback the "attachment registry" (i.e. Tools > Note attachments menu)
  • is there an easy way to completely rollback my Joplin notebook to a previous state
  • any other advice or tips

Joplin Version: 2.9.17
Operating System: Mac OS X

Thank you very much

1 Like

Example of what I mean

For example, old note says this, and it is broken

![f8d2d854317ad457b096ac99b9ff86e7.png](:/fbcef43cc69948afb8fadb7597327dde)

Now, I look up this file name in Tools > Note attachments to get the mapping. The mapping says:

f8d2d854317ad457b096ac99b9ff86e7.png 38.3 kB 54b3ea20efee45ae992155c43df2301c

So now I replace it like this:

![f8d2d854317ad457b096ac99b9ff86e7.png](:/54b3ea20efee45ae992155c43df2301c)

and it works

I searched around a bit and think the best bet for replacing list of terms in bulk is to fork replace utility in joplin-utils by @rxliuli. As barebones adhoc solution it needs just a single loop passing values to $keyword / $replace and form(s) to upload the terms.

Yet another way to replace terms in bulk to consider is via extracting .jex backup and editing the files via inline editors such as sed and awk.

Disclaimer: This is not recommended for anything more than emergency recovery as the method may corrupt the database for profile.

Perhaps you could also write your own script using the API for this. But what plugins did this?

Thanks everyone for suggestions. The plugin that I used was attaché. According to docs, it was supposed to swap-in-place the attachments using the OLD attachment id (which is good, because it allows notes to remain the same). but in my particular usage it created NEW attachment ids which invalidated the old notes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.