Attachments lost after reorganizing notes

Hi,

I think, I lost many attachments.

I use nextcloud for syncing.

Before switching to Joplin I used Evernote. I normally scan documents to pdf and these pdfs where added to Evernote, one scan one note.

With Joplin I have to do this manually. So, I dicided to summerize some note to one.

Before

  • note A with attachment A
  • note B with attachment B
  • note C with attachment C

Now

  • Note with attachment A, B, C
    I copied (sometimes I maybe used cut and paste) the whole link from the notes B und C to the summary-note A. After copying I deleted the old note B and C.

Now, the attachments from B and C are gone. I get the little J-Icon and can not open the attachments. Attachment A is still there.

This is a big problem. I lost so many important documents. I am desperate. I have backups but I use Joplin since more than two years. I can not recover every attachment.

I hope, there is another way.

Best regards
Kay

Question for recovery: Is there a way to search for notes with orphaned attachments?

Check if they are in your resource folder or not. The attachment markdown should look like [AttachmentName](:/0c993a43c13346fdba587bf5ca507017) and that id should correspond to a file in your resources directory (i.e. .config/joplin-desktop/resources) (click help > open profile directory if you don't know where it is)

The attachments are gone. I just open joplin on another device. It starts to delete more than 100 resources that are still in use. I found the ressources in old time machine backups.

Not natively but there are tools such a @rxliuli's batch-web tool which has options to check for orphaned resources and orphaned links

Then I assume they are missing from your sync target for some reason and Joplin is reflecting the deletion of them. I assume your latest backup would have all your old resources stored?

I think, this is a serious bug. Joplin thinks the ressources aren't in use after I copied them to the new note and remove the old note. I do this since a few months. So I have to search through many backups. This is a nightmare.

Before we go that far could you explain exactly what you did?
Did you just copy the markdown tag with resource id (like I posted before) between notes? Or something else?

I copy the whole markdown-link: ...

Another example:
Before
Note Invoice Jan with attachment jan
Note Invoice Feb with attachment feb
Note Invoice Mar with attachment mar
... and so on

Copy all links from feb - dec to note Jan and rename "note Jan" to "note year"
Remove notes feb - dec.

Now, all attachments from feb - dec are gone, attachment from jan is still there.

The batch script don't help me. It shows no note with orphaned resources.

Make sure you put any markdown in a code fence, Discourse also uses markdown.

I'm sorry. One example. I copy the whole markdown-link:
[invoice_jan.pdf](:/9b980800659c4da5b60b1a40219a46dd)

I'll have a go at replicating it so just to be clear its something like:

Note 1:
[attachment_jan](:/abc...)

Note 2:
[attachment_feb](:/def...)

You then rename Note1 to Summary and copy Note2's attachment data into Summary so it now looks like:

Summary:
[attachment_jan](:/abc...)
[attachment_feb](:/def...)

Then you delete Note2 and the resources no longer show up and are being deleted?

Also, just for information, what is your note history config set as?

Also what Joplin version and OS?

Yes, that is nearly correct: I don't delete Note1 because this note is renamed to "Summary".

Here the history config:
Mac 1: 365
Mac 2: 90
Android 1: 372
iPad: 90
PC 1: I think 90
Portable: I think 90

I always use the latest version.
On Mac 1: Joplin 2.7.15 (prod, darwin)

Client-ID: 3e3ae07d1fbf4621b9bdb4a1f90d201e
Sync-Version: 3
Profil-Version: 41
Unterst├╝tzter Schl├╝sselbund: Ja

Revision: 8352e23

Android 1: Joplin 2.7.2
iPad 1: Joplin 12.7.2

Yeah I forgot to change the last bit.

If you don't have any clients with note history off then I wouldn't expect to see your resources being deleted until that limit has been reached.

I notized one interesting fact: I create such summery-notes since many months.

I have a summery-note from 29.08.2021. Here, all attachments are there. Also from Jan. 2022.

But on summery notes from Mar. 2022, all attachments (except one) are gone.

What? The note history deletes old attachments? WTF? The note-history shouldn't delete attachments that are still in use.

I have notes from 2016 with attachments. The attachments are still there.

Yes, if you had a note with a picture and you then deleted that picture entirely with no other notes referencing it then wouldn't you expect the attachment to be deleted? The note history setting would preserve it until the note revisions themselves are deleted at which point nothing else in the database references it.

In your case it doesn't sound like it should be applicable because you have a reference to that attachment in another note.

Joplin copies with full absolute path if you do copy and paste using the visual editor. This is a bug and completely wrong way to handle internal copy pasting of images. I reported this already. You might be hitting this one.