Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete resource via API does not delete resource from sync target #1694

Closed
tessus opened this issue Jun 27, 2019 · 9 comments

Comments

Projects
None yet
3 participants
@tessus
Copy link
Collaborator

commented Jun 27, 2019

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.

@mgrandi

This comment has been minimized.

Copy link

commented Jun 28, 2019

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

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 28, 2019

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

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 2, 2019

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

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 2, 2019

Which scripts?

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 2, 2019

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

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 2, 2019

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.

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 2, 2019

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

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 13, 2019

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.

@laurent22 laurent22 closed this in ec10898 Jul 13, 2019

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 13, 2019

hmm, interesting, will this also solve #932?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.