Joplin: delete resource via API does not delete resource from sync target

Created on 27 Jun 2019  ·  9Comments  ·  Source: laurent22/joplin

Operating system

  • macOS

Application

  • Desktop

I've just noticed that the API command to delete resources does not delete the resources from the sync target. Only the meta data files are deleted from the sync target.

This is the command I used:

curl -X DELETE http://localhost:41184/resources/ecfef68586324b6a88149f651af58068?token=TOKEN

After syncing ecfef68586324b6a88149f651af58068.md is removed from the sync target, but .resources/ecfef68586324b6a88149f651af58068 still remains.

api bug

All 9 comments

sort of unrelated, but this doesn't happen for regular usage either, like there is no way to tell joplin that a resource is 'deleted' i guess in regular use (not using the API) so if you remove all references to a resource, it just hangs around forever

i feel that it _might_ be desired behavior to keep them around in normal use, in which case i feel like a UI to show what resources exist and maybe a filter for 'orphaned' ones where you can choose which ones to delete, rename, etc, would be useful

@mgrandi theroetically, orphaned resources are supposed to be deleted after 24-48h automatically. see #932

@laurent22 shall I make my scripts available or do you think they could end up creating more harm than good?

Which scripts?

@laurent22 just sent you the repo invite. If you think they could help others, I can make the repo public.

Sure feel free to publish it, especially as long as the warning is there it's fine. Eventually these resource bugs should be fixed but in the meantime these scripts can be useful.

As a reference for others... Here's the link to the repo with the scripts:
https://github.com/tessus/joplin-scripts

There was indeed a bug here. It wasn't about the API, but the synchronizer simply didn't delete resource data from the sync target, and has never done so. I can't believe I missed that, and that no-one ever noticed till today.

For good measure, I've also added a test for the API to make sure local data is deleted. For remote data, I've added the test to the synchronizer test units.

hmm, interesting, will this also solve #932?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LifeIsAParadox picture LifeIsAParadox  ·  3Comments

jurgenhaas picture jurgenhaas  ·  3Comments

okoetter picture okoetter  ·  3Comments

alexanderadam picture alexanderadam  ·  3Comments

deftdawg picture deftdawg  ·  3Comments