mgmeyers / obsidian-pandoc-reference-list

Display a formatted reference in Obsidian's sidebar for each pandoc citekey in the active document.
GNU General Public License v3.0
176 stars 9 forks source link

Plugin fails to load multiple bibliography paths from frontmatter: array handled as string #92

Open Gewerd-Strauss opened 9 months ago

Gewerd-Strauss commented 9 months ago

Hello there,

The plugin seems to break down if the user supplies more than one .bib-file via the frontmatter. Take the following example note:

---
alias: 
creation date: "2023-12-25 23:43"
modification date: "2023-12-25 23:43"
tags: 
bibliography: "D:/Dokumente neu/Zotero_Papers/Zotero_papers_autosync.bib"
---

[@kaufmannNovelApproachesTuberculosis2017] 

This will render properly: grafik

However, if we need to hand in multiple bibs, the plugin breaks down:

---
alias: 
creation date: "2023-12-25 23:43"
modification date: "2023-12-25 23:43"
tags: 
bibliography:
  - D:/Dokumente neu/Zotero_Papers/Zotero_papers_autosync.bib
  - grateful-refs.bib
---

[@kaufmannNovelApproachesTuberculosis2017] 

When jumping to function QL from the error thrown - jumping to QL (plugin:obsidian-pandoc-reference-list:79:4500), and breaking on the 2nd return-statement of the QL-function, I can then run some tests:

grafik

As you can see, the trim()-function cannot handle the array-input it receives if you supply multiple paths. If I manually assign a value and test again while debugging, no issue is thrown and the path is properly trimmed.

The simplest solution in prinicple is to check if s is an array, then iterate over its members and perform the remainder of the function as appropriate. If s is not an array, the function can operate as it does right now.

But then again, this is only from what I can see and consider after taking a short look at the code exposed to obsidian rn.


I have no idea how much additional code is not compliant with multiple paths, as this is the extent to which I was able to test right now. I am not well-experienced in TS&JS, only speaking from general programming- & debugging experiences here. Furthermore, I currently don't have the setup to debug this myself using source - not beyond reading the code, and that only gets you so far without a debugger.


I hope these details are sufficient. I will happily supply further details as requested.

Thank you.
Sincerely,
~Gw


Edit 28.12.2023 14:55:

I also tested whether or not quoting the paths made any difference (given they contain spaces) - it doesn't.

Gewerd-Strauss commented 9 months ago

I currently don't have the time to sift through the source code to decompile what the function is actually called before compilation makes everything a huge mess of 2-letter combinations in an attempt to find the function's actual name.