Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM: Fix proxy behavior for bibtex and PDF #1460

Merged
merged 2 commits into from
Nov 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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