Skip to content

Commit

Permalink
more jstor proxy removal (#1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann committed Feb 25, 2019
1 parent 7e477c1 commit eb0abf5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,20 +856,27 @@ public function get_identifiers_from_url($url_sent = NULL) {
$this->set($url_type, $url); // Save it
}
}

// https://www.jstor.org.stuff/proxy/stuff/stable/3347357 and such
if (preg_match('~^(https?://(?:www\.|)jstor\.org)(?:\S*proxy\S*/|/)(?:stable|discover)/10.2307/(.+)$~i', $url, $matches)) {
$url = $matches[1] . '/stable/' . $matches[2] ; // that is default. This also means we get jstor not doi
if (!is_null($url_sent)) {
$this->set($url_type, $url); // Update URL with cleaner one. Will probably call forget on it below
}
}

// https://www.jstor.org.libweb.lib.utsa.edu/stable/3347357 and such
if (preg_match('~^https?://(?:www\.|)jstor\.org\.[^/]+/(?:stable|discover)/(.+)$~i', $url, $matches)) {
$url = 'https://www.jstor.org/stable/' . $matches[1] ;
if (!is_null($url_sent)) {
$this->set($url_type, $url); // Update URL with cleaner one
}
}
// https://www-jstor-org.libezp.lib.lsu.edu/stable/10.7249/j.ctt4cgd90.10 and such
if (preg_match('~^https?://(?:www-|)jstor-org[-\.]\S+/(?:stable|discover)/(.+)$~i', $url, $matches)) {
$url = 'https://www.jstor.org/stable/' . $matches[1] ;
if (!is_null($url_sent)) {
$this->set($url_type, $url); // Update URL with cleaner one
}
}
}

if (preg_match("~^https?://(?:d?x?\.?doi\.org|doi\.library\.ubc\.ca)/([^\?]*)~i", $url, $match)) {
quietly('report_modification', "URL is hard-coded DOI; converting to use DOI parameter.");
Expand Down

0 comments on commit eb0abf5

Please sign in to comment.