PKM-er / obsidian-zotlit

A third-party project that aims to facilitate the integration between Obsidian.md and Zotero, by providing a set of community plugins for both Obsidian and Zotero.
https://zotlit.aidenlx.top
MIT License
675 stars 29 forks source link

[BUG] When the zt-attchments are not matched between Obisidian and Zotero #382

Open WayenVan opened 2 months ago

WayenVan commented 2 months ago

Hi, This issue happens when I have two different itemID of the same Item in different device

When I update the note, it jump out a selection manual

Actaul behaviour:

image

and after I select one of them, it poped up error:

image

Expect behaviour

At least message that I have a wrong zt-attchments ID in my notes, and popup possible IDs in current dataset

Debug info

image

here when no item in l could match with u (indicate c.length ===0) cause this weird behavior. here is the value I used to reproduce

image

PS

Does anyone know why the same Zotero item could have different itemID among different devices? is that an sync error or just means itemID could not be regarded as "unique identity"?

WayenVan commented 2 months ago

Update, the itemID is different across the different devices, so need to update everytime I switch devices, it is quite inconvenient.

dcgk commented 1 month ago

Hi! I am coming to this from a different perspective/usecase, but hope what I have figured out might be helpful to some.

I have been trying to find an efficient way to manage annotations from pdf attachments as I move them from being managed internally by Zotero as attachments to being linked pdf files in Zotero. The benefit of managed pdf attachments is that they are synced accross devices with Zotero Sync. For example: it is possible to make annotations in a pdf on your iPad using the Zotero app. Zotero Sync brings those annotations back to your desktop Zotero and they show up in Obsidian via ZotLit Annotation View. It is super fast and efficient! However, Zotero storage is limited and if your library is more than 6GB you need the unlimited plan for 120USD/year. The best option is to simply get that unlimited plan and support Zotero. if that is too much, then you need to shuffle around attachments from being managed internally to being linked- for example using a Zotero plugin such as ZotMoov. However, once you move an attachmant from being internally managed by Zotero to being a linked pdf - the pdf attachment is assigned both a new 'itemID' and 'key' by Zotero. This happens each time, so it is not the case that attachments get reassigned the same 'itemID' and 'key' when they are moved back to being linked/attached. This 'itemID' is the 'it.attachment.itemID' which is automatically assigned by ZotLit to the YAML frontmatter property 'zt-attachmants' of the Literature Note when it is first created. Once your pdf attachment has a different it.attachment.itemID, the updating of your Literature Note does not function anymore. You can manually update the YAML frontmatter property 'zt-attachmants' to the new 'it.attachment.itemID' and then updating of your Literature Note will work again. However, the old links from previous annotations will not work anymore. These links use the 'it.attachment.key' which is made up of eight capitalized letter or digits. It looks identical to the 'it.key' which is the item (book/paper/article) in Zotero and is used by ZotLit in the YAML frontmatter property 'zotero-key' But the two are very different! 'it.key' identifies the item. 'it.attachmant.key' identifies the attachment. If you want your old links to work after the 'it.attachment.key' has changed you simply need to run a 'find and replace' over your markdown note. It is possible to automate this with a Templater template.

Ok, enough for now. hopefully this is helpful to someone. Greetings!