# Attachments lost again

**URL:** <https://discourse.joplinapp.org/t/attachments-lost-again/2131>\
**Category:** Support\
**Created:** [16 April 2019 00:27 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131 "2019-04-16T00:27:39Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://discourse.joplinapp.org/u/eagle)\
**Post date:** [16 April 2019 00:27 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/1 "2019-04-16T00:27:39Z")

</div>

A couple of times I have suspected that Joplin deletes file attachments that are not orphans - and now I have experienced it again.

I understand that Joplin regularly traverse through all attachments to see if they are not linked from any notes - and if they are not Joplin deletes the attachments.

I feel that this is a very dangerous behaviour - and i am beginning to think I can not trust Joplin to store important file attachments anymore.

The problem was discovered now with a note that I have kept for about 9 months now. Each month I add a new file attachment to the note. Now I suddenly discovered that 7 attachments of 8 has been deleted from this note. Only the newest attachment is still available.

Sync method is Dropbox. E2E encryption. My Joplin clients: Android, iOS, Win, Linux.

---

<div class="post-metadata">

**Author:** ![tessus](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/tessus/32/13_2.png) [@tessus](https://discourse.joplinapp.org/u/tessus)\
**Post date:** [16 April 2019 01:05 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/2 "2019-04-16T01:05:40Z")

</div>

For me, it’s the other way around: Orphaned resources are not removed.

Your case is by far more serious than my problem, but maybe they are related somehow.

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [16 April 2019 08:58 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/3 "2019-04-16T08:58:10Z")

</div>

If you search for the resource IDs in your profile `resources` folder, can you find anything?

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [16 April 2019 09:16 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/4 "2019-04-16T09:16:45Z")

</div>

Also could you post here the part of your note that contains the resource markup?

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://discourse.joplinapp.org/u/eagle)\
**Post date:** [16 April 2019 23:11 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/5 "2019-04-16T23:11:13Z")

</div>

Hi Laurent

This is the part of my note that contains the resource markup:

```
## Program:

[Program april 2019.pdf](:/4d81dd287cce451380ff94be114ecabb)

[Program mars 2019.pdf](:/8240e4d4268741918f331c5e82eea43f)

```

The first file opens fine. The second one seems to be lost.

Searching for the first file (which opens fine) on Ubuntu gives:

```
locate 4d81dd287cce451380ff94be114ecabb
/home/egil/.config/joplin-desktop/resources/4d81dd287cce451380ff94be114ecabb.crypted
/home/egil/.config/joplin-desktop/resources/4d81dd287cce451380ff94be114ecabb.pdf
/home/egil/Dropbox/Apps/Joplin/4d81dd287cce451380ff94be114ecabb.md
/home/egil/Dropbox/Apps/Joplin/.resource/4d81dd287cce451380ff94be114ecabb

```

Searching for the second file (which seems deleted when I click on it in Joplin) gives:

```
locate 8240e4d4268741918f331c5e82eea43f
/home/egil/.config/joplin-desktop/resources/8240e4d4268741918f331c5e82eea43f.crypted
/home/egil/Dropbox/Apps/Joplin/.resource/8240e4d4268741918f331c5e82eea43f

```

Thanks for all help!

Egil

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [20 April 2019 20:16 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/6 "2019-04-20T20:16:50Z")

</div>

Issue to track this: [https://github.com/laurent22/joplin/issues/1433](https://github.com/laurent22/joplin/issues/1433)

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [21 April 2019 12:55 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/7 "2019-04-21T12:55:36Z")

</div>

Ok I’ve finally found what the issue was - it was a race condition between the encryption service and the resource service, which could affect notes that are often modified but with long periods of time between changes.

So these fixes have been made:

- Added two test units to cover this case and make sure it won’t happen again.
- Fixed the bug obviously
- Added additional checks before deleting a resource to make sure it’s really not used in any note.

These changes should definitely make the resource management more reliable.

Thanks @eagle for providing the info that helped figure this out and sorry for the lost attachments! If you don’t have any other copy of these files left, I think they can be manually recovered from the artefacts left in Dropbox and your config directory. If you want to do that, let me know.

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://discourse.joplinapp.org/u/eagle)\
**Post date:** [29 April 2019 21:13 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/8 "2019-04-29T21:13:09Z")

</div>

Hi @laurent

Thanks a lot for fixing this issue. I have gone through all notes and there are a few attachment that are gone that I do not have anywhere else… Is there a way I could recover them myself?

Thanks for all help!

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [29 April 2019 22:25 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/9 "2019-04-29T22:25:26Z")

</div>

The file that are left, for example “8240e4d4268741918f331c5e82eea43f” is basically the attachment you had. So if you know the file extension you can simply add it and it should open. For example if it’s a PDF, you rename it to 8240e4d4268741918f331c5e82eea43f.pdf. Unfortunately some metadata, such as the filename is lost.

---

<div class="post-metadata">

**Author:** ![eagle](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@eagle](https://discourse.joplinapp.org/u/eagle)\
**Post date:** [30 April 2019 10:14 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/10 "2019-04-30T10:14:53Z")

</div>

Thanks @laurent

I am still a bit unsure on which file should be renamed. The one in local resources or the one in Dropbox sync folder.

In the example below - which file should I rename?

```
locate 8240e4d4268741918f331c5e82eea43f
/home/egil/.config/joplin-desktop/resources/8240e4d4268741918f331c5e82eea43f.crypted
/home/egil/Dropbox/Apps/Joplin/.resource/8240e4d4268741918f331c5e82eea43f

```

Thanks for all help!

---

<div class="post-metadata">

**Author:** ![ipra](https://avatars.discourse-cdn.com/v4/letter/i/73ab20/32.png) [@ipra](https://discourse.joplinapp.org/u/ipra)\
**Post date:** [2 May 2019 10:23 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/11 "2019-05-02T10:23:08Z")

</div>

Thanks, Eagle, for reporting this issue! Being able to trust that Joplin won´t loose any of my numerous attachments is critical to me.

Are there any checks I could take into my workflow to keep track on the state of my list of attachments - e.g. verifying any losses every time I make backup? My notes are encrypted.

Being able to do this would improve Joplin over the competition yet another step, actually.

---

<div class="post-metadata">

**Author:** ![laurent](https://avatars.discourse-cdn.com/v4/letter/l/ce7236/32.png) [@laurent](https://discourse.joplinapp.org/u/laurent)\
**Post date:** [2 May 2019 10:38 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/12 "2019-05-02T10:38:11Z")

</div>

The most reliable way to see what’s happening with your data in Joplin is to automatically setup a backup with git versioning as I’ve done there: [Best method to backup notes](https://discourse.joplinapp.org/t/best-method-to-backup-notes/1135/2)

Another thing that will be happening soon is that notes will be versioned so even if something is deleted (even due to a bug), you’ll still be able to see the previous versions of the notes.

---

<div class="post-metadata">

**Author:** ![ipra](https://avatars.discourse-cdn.com/v4/letter/i/73ab20/32.png) [@ipra](https://discourse.joplinapp.org/u/ipra)\
**Post date:** [2 May 2019 13:34 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/13 "2019-05-02T13:34:01Z")

</div>

Excellent news!

---

<div class="post-metadata">

**Author:** ![samjonas](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@samjonas](https://discourse.joplinapp.org/u/samjonas)\
**Post date:** [8 May 2019 10:10 UTC](https://discourse.joplinapp.org/t/attachments-lost-again/2131/14 "2019-05-08T10:10:31Z")

</div>

Had the same problem, Now fixed… thank You
