diff --git a/README.md b/README.md index fe88263..746a547 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ specified in your workflow settings. queries (see: [smart queries](#search)). - A `📎` indicates that the BibTeX entry has a `file` or `attachment` field. You can use to open the - attachment. + attachment. If there are multiple attachments, the first one is opened. ### Link Preview - Install the diff --git a/scripts/write-citation-picker-buffer.js b/scripts/write-citation-picker-buffer.js index 7692e7c..d41d043 100755 --- a/scripts/write-citation-picker-buffer.js +++ b/scripts/write-citation-picker-buffer.js @@ -228,7 +228,9 @@ function bibtexParse(rawBibtexStr) { } case "file": case "attachment": { - entry.attachment = value; + // see https://github.com/chrisgrieser/alfred-bibtex-citation-picker/issues/45 + const multipleAttachments = value.includes(";/Users/"); + entry.attachment = multipleAttachments ? value.split(";/Users/")[0] : value; break; } default: