Skip to content

Commit

Permalink
Cairn.info: Serialize requests; fix PDF attachment URL (#3165)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe-translates authored Oct 24, 2023
1 parent 0fdbcd0 commit 0121bf0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Cairn.info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2022-05-31 18:42:02"
"lastUpdated": "2023-10-23 08:08:57"
}

/*
Expand Down Expand Up @@ -80,11 +80,9 @@ function getSearchResults(doc, checkOnly) {
async function doWeb(doc, url) {
if (await detectWeb(doc, url) == 'multiple') {
let items = await Zotero.selectItems(getSearchResults(doc, false));
if (items) {
await Promise.all(
Object.keys(items)
.map(url => requestDocument(url).then(scrape))
);
if (!items) return;
for (let url of Object.keys(items)) {
await scrape(await requestDocument(url));
}
}
else {
Expand Down Expand Up @@ -125,7 +123,7 @@ async function scrape(doc) {

if (pdfLink) {
item.attachments.push({
url: pdfLink.href,
url: pdfLink,
title: 'Full Text PDF',
mimeType: 'application/pdf'
});
Expand Down

0 comments on commit 0121bf0

Please sign in to comment.