The “Delete unlinked resources” plugin will delete all attachments in Joplin 3

Operating system

Windows

Joplin version

3.0.13

Desktop version info

Joplin 3.0.13 (prod, win32)

Client ID: 5040eb18e5134cc0ad9585305dfd1859

Sync target

OneDrive

Editor

Markdown Editor

What issue do you have?

The plugin ‘Delete unlinked resources’ does not work in Joplin version 3. It appears to delete all attachments.
It seems better to disable the download link of this plugin.
Is there a change in version 3 that would prevent this from working?

The original plugin's GitHub repository has been removed, but the source code is now available here.
github/snake-git/joplin-plugin-jl14-pub

Screenshots

2 Likes

Thank you for reporting this plugin, it has now been removed from the database.

2 Likes

It's possible that older attachments are still safe:

Explanation based on the plugin's code.

The plugin seems to use the following logic to determine if a resource is unlinked:

0 == (await joplin.data.get(['resources', resource.id, 'notes'])).items.length

This requests the list of notes associated with resource.id from Joplin. Joplin responds to this request using information that isn't updated very often (I think 30 seconds after Joplin's startup, then every few hours). As such, the plugin thinks that a resource that was just attached to a note is linked to by no notes.

Based on this, older attachments might still be safe.

Edited: Reformatted and reworded.

2 Likes

Thanks for supporting the plugin database and clear explanation!

In my Joplin profile, this plugin also deleted the old image files that were attached to the "Welcome" message when I installed Joplin a few months ago.
It may have deleted old attachments as well. I haven't figured out how to create a plugin or the API, but I'd like to try to improve the plugin if there's a way to fix it.

Does the web utility at Joplin Batch show the same behaviour, or is it still safe to use with Joplin 3?

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