It appears that resources in Joplin are given names based on UUIDs.
When we attach the same file in multiple we end up creating duplicate resources. We can presently work around this by only attaching the resource in one file and copying the markdown link into other files. However, I feel we can deduplicate (possibly only unencrypted) resources as follows
- Switch to using checksum (like sha256) as a resource ID - this is backwards compatible since existing links would still work as they are just paths. However, there would still be duplication of new resources with ones created prior to this change - Also, there may be collisions between checksums and UUIDs.
- Add a checksum column to resources in database.sqlite and simply deduplicate unencrypted resources based the checksum.
For instance, here are two entries in my database.sqlite which are exact duplicates
- I can work on this if there isn’t something obvious that I am missing because of which deduplication would be considered a bad thing to do.