Skip to content

Commit

Permalink
ACM: Fix proxy behavior for bibtex and PDF (zotero#1460)
Browse files Browse the repository at this point in the history
Closes zotero#1449
We grab URLs of the page, but they default to http version there, which
causes all sorts of havoc for https version with hyphenated
proxy. Solving this simply by deproxifying standard pattern.
  • Loading branch information
adam3smith authored Nov 7, 2017
1 parent 67eadc5 commit 2bad8b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ACM Digital Library.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2017-01-26 12:12:58"
"lastUpdated": "2017-10-29 04:47:45"
}

/*
Expand Down Expand Up @@ -94,7 +94,8 @@ function scrape(doc) {

//compose bibtex URL
var bibtexstring = 'id=' + itemID + '&parent_id=' + parentID + '&expformat=bibtex';
var bibtexURL = url.replace(/citation\.cfm/, 'downformats.cfm')
var bibtexURL = url.replace(/dl[.-]acm[.-]org[^\/]*/, "dl.acm.org") //deproxify the URL above.
.replace(/citation\.cfm/, 'downformats.cfm')
.replace(/([?&])id=[^&#]+/, '$1' + bibtexstring);
Zotero.debug('bibtex URL: ' + bibtexURL);

Expand All @@ -106,8 +107,10 @@ function scrape(doc) {
//get the URL for the pdf fulltext from the metadata
var pdfURL = ZU.xpath(doc, '//meta[@name="citation_pdf_url"]/@content')[0];
if (pdfURL) {
pdfURL = pdfURL.textContent.replace(/dl[.-]acm[.-]org[^\/]*/, "dl.acm.org"); //deproxify URL
Z.debug("pdfURL: " + pdfURL);
item.attachments = [{
url: pdfURL.textContent,
url: pdfURL,
title: "ACM Full Text PDF",
mimeType: "application/pdf"
}];
Expand Down

0 comments on commit 2bad8b9

Please sign in to comment.