Skip to content

Commit

Permalink
Restore DOI from URL extraction (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode authored and dstillman committed Jan 10, 2019
1 parent 5848d9e commit 158ebc6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/webSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@ WebSession.prototype.handleURL = async function () {
this.ctx.throw(400, "Remote page not found");
}

if (e instanceof Zotero.HTTP.ResponseSizeError) {
this.ctx.throw(400, "Response exceeds max size");
}

if (e instanceof Zotero.HTTP.UnsupportedFormatError) {
this.ctx.throw(400, "The remote document is not in a supported format");
}

//Parse URL up to '?' for DOI
let doi = Zotero.Utilities.cleanDOI(decodeURIComponent(url).match(/[^\?]+/)[0]);
if (doi) {
Expand All @@ -191,6 +183,14 @@ WebSession.prototype.handleURL = async function () {
return;
}

if (e instanceof Zotero.HTTP.ResponseSizeError) {
this.ctx.throw(400, "Response exceeds max size");
}

if (e instanceof Zotero.HTTP.UnsupportedFormatError) {
this.ctx.throw(400, "The remote document is not in a supported format");
}

// No more URLs to try
if (i == urlsToTry.length - 1) {
this.ctx.throw(500, "An error occurred retrieving the document");
Expand Down

0 comments on commit 158ebc6

Please sign in to comment.