Lost all the images in my notes

Bug report

All the images of all my notes disappeared.

I do not use images in notes very often but I just found that all my images in notes appear as broken links. I’m not sure when it started happening as just a few notes have them, but they are important.
This is the same issue on Android and Linux.


How can I recover them?


  • Platform: (Ubuntu/Android)
  • Platform version: (Mojave/10/16.04)
  • App Version: (4.5.1)


Not sure as I’m not sure when it started happening.

Hi Jeremi,

Thank you for the report.
I checked the database and confirmed that the files you mentioned have been deleted.
Have you restored data from a backup before?
Because when deleting files is only when you restore data with missing files by design.
Please check your backup.
If you have a snapshot of your backup with them, there is a chance to restore.
I checked you still have some images in the database.
I’m afraid that it is not possible to restore them from the database once deleted, sorry.

If you don’t have a backup with lost files, please try this to check if your desktop client has them in its local database.
Select Developer -> Toggle Developer Tools and run the below code in the console:

var db = inkdrop.main.dataStore.getLocalDB()
await db.pouch.get('file:gbPz8Cmy9', {open_revs: "all", revs: true})

And please let me know the output.
If it has the old revision, you should get like this:

Yes, it seems it has it:

  • Why would they be marked deleted?
  • How can I recover them?


I’ve used restore once, but that was a long time ago (August 2019 Inkdrop on Windows randomly not shutting down correctly again last 2 versions ). I ended up loosing some data when doing this restore because I’m using the mobile version as well, and the changes in the mobile app had been overwritten. So I’ve never done any restore since.

The notes I gave in the exemple has been created after the restore, so it cannot be due to it.

How do I check this?

I did not delete the files myself, so how come they were deleted?

That’s weird, but I only inserted the deletion code in the restoration process.
So I can’t say anything unless I could reproduce it.

Please read the documentation about backup.
You have files named with document ID such as file:gbPz8Cmy9.json in the backup folder.

I understand seriously this issue.
To avoid this kind of accidents in the future, it would better remove the deletion code from the backup restoration process. So it is going to be a process that just merges data from files into the database.

How to salvage images from the local database

Good to hear you still have them in the local database.
To salvage deleted images which are still in your local database, please run the below script in the console:

async function restoreImage(docId, pathToSave) {
	var db = inkdrop.main.dataStore.getLocalDB()
	var revs = await db.pouch.get(docId, { revs: true, open_revs: 'all' })
	var oldDoc = await db.pouch.get(docId, {rev:`1-${revs[0].ok._revisions.ids[1]}`, attachments: true, binary: true })
	var data = oldDoc._attachments.index.data
	var fs = require('fs')
	fs.writeFileSync(pathToSave, data)

And then, call restoreImage function respectively like so:

await restoreImage('file:gbPz8Cmy9', '<PATH_TO_SAVE>')

Please replace PATH_TO_SAVE to the file path to save like /tmp/clipboard.png.
Hope that works.

Thanks, will try it.

But I’m sure it is not done to a restore as I did only once, and it was before this doc was created.

That’s strange but I don’t know at the moment.
I will check the codebase but please let me know if you found how to reproduce it.