- closes #261, work around content-disposition: attachment on endnote links. this workaround is far from the most elegant, but it seemed nicer than writing a stream converter component that didn't really convert streams
- fixes bugs in RIS import
This commit is contained in:
parent
539957a93b
commit
60422e032e
|
@ -46,6 +46,20 @@ Scholar.Ingester.ProxyMonitor = new function() {
|
||||||
function observe(channel) {
|
function observe(channel) {
|
||||||
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
channel.QueryInterface(Components.interfaces.nsIHttpChannel);
|
||||||
try {
|
try {
|
||||||
|
// remove content-disposition headers for endnote, etc.
|
||||||
|
var contentType = channel.getResponseHeader("Content-Type").toLowerCase();
|
||||||
|
for each(var desiredContentType in Scholar.Ingester.MIMEHandler.URIContentListener.desiredContentTypes) {
|
||||||
|
if(contentType.length < desiredContentType.length) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if(contentType.substr(0, desiredContentType.length) == desiredContentType) {
|
||||||
|
channel.setResponseHeader("Content-Disposition", "", false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// find ezproxies
|
||||||
if(channel.getResponseHeader("Server") == "EZproxy") {
|
if(channel.getResponseHeader("Server") == "EZproxy") {
|
||||||
// We're connected to an EZproxy
|
// We're connected to an EZproxy
|
||||||
if(channel.responseStatus != "302") {
|
if(channel.responseStatus != "302") {
|
||||||
|
@ -479,7 +493,10 @@ Scholar.Ingester.MIMEHandler = new function() {
|
||||||
* nsIURIContentListener interface to grab MIME types
|
* nsIURIContentListener interface to grab MIME types
|
||||||
*/
|
*/
|
||||||
Scholar.Ingester.MIMEHandler.URIContentListener = new function() {
|
Scholar.Ingester.MIMEHandler.URIContentListener = new function() {
|
||||||
var _desiredContentTypes = ["application/x-endnote-refer", "application/x-research-info-systems"];
|
// list of content types to capture
|
||||||
|
// NOTE: must be from shortest to longest length
|
||||||
|
this.desiredContentTypes = ["application/x-endnote-refer",
|
||||||
|
"application/x-research-info-systems"];
|
||||||
|
|
||||||
this.QueryInterface = QueryInterface;
|
this.QueryInterface = QueryInterface;
|
||||||
this.canHandleContent = canHandleContent;
|
this.canHandleContent = canHandleContent;
|
||||||
|
@ -497,7 +514,7 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function canHandleContent(contentType, isContentPreferred, desiredContentType) {
|
function canHandleContent(contentType, isContentPreferred, desiredContentType) {
|
||||||
if(Scholar.inArray(contentType, _desiredContentTypes)) {
|
if(Scholar.inArray(contentType, this.desiredContentTypes)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -510,7 +527,7 @@ Scholar.Ingester.MIMEHandler.URIContentListener = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPreferred(contentType, desiredContentType) {
|
function isPreferred(contentType, desiredContentType) {
|
||||||
if(Scholar.inArray(contentType, _desiredContentTypes)) {
|
if(Scholar.inArray(contentType, this.desiredContentTypes)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -537,6 +554,8 @@ Scholar.Ingester.MIMEHandler.StreamListener = function(request, contentType) {
|
||||||
getService(Components.interfaces.nsIWindowWatcher);
|
getService(Components.interfaces.nsIWindowWatcher);
|
||||||
this._frontWindow = windowWatcher.activeWindow;
|
this._frontWindow = windowWatcher.activeWindow;
|
||||||
this._frontWindow.Scholar_Ingester_Interface.Progress.show();
|
this._frontWindow.Scholar_Ingester_Interface.Progress.show();
|
||||||
|
|
||||||
|
Scholar.debug("EndNote prepared to grab content type "+contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function(iid) {
|
Scholar.Ingester.MIMEHandler.StreamListener.prototype.QueryInterface = function(iid) {
|
||||||
|
|
|
@ -745,7 +745,9 @@ Scholar.Date = new function(){
|
||||||
Scholar.debug("DATE: got year ("+date.year+", "+date.part+")");
|
Scholar.debug("DATE: got year ("+date.year+", "+date.part+")");
|
||||||
|
|
||||||
// get short month strings from CSL interpreter
|
// get short month strings from CSL interpreter
|
||||||
|
if(!months) {
|
||||||
var months = CSL.getMonthStrings("short");
|
var months = CSL.getMonthStrings("short");
|
||||||
|
}
|
||||||
if(!_monthRe) {
|
if(!_monthRe) {
|
||||||
// then, see if have anything resembling a month anywhere
|
// then, see if have anything resembling a month anywhere
|
||||||
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]* (.*)$", "i");
|
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]* (.*)$", "i");
|
||||||
|
@ -791,6 +793,9 @@ Scholar.Date = new function(){
|
||||||
string += date.part+" ";
|
string += date.part+" ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!months) {
|
||||||
|
var months = CSL.getMonthStrings("short");
|
||||||
|
}
|
||||||
if(date.month != undefined && months[date.month]) {
|
if(date.month != undefined && months[date.month]) {
|
||||||
// get short month strings from CSL interpreter
|
// get short month strings from CSL interpreter
|
||||||
var months = CSL.getMonthStrings("long");
|
var months = CSL.getMonthStrings("long");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- 85
|
-- 86
|
||||||
|
|
||||||
-- Set the following timestamp to the most recent scraper update date
|
-- Set the following timestamp to the most recent scraper update date
|
||||||
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00'));
|
REPLACE INTO "version" VALUES ('repository', STRFTIME('%s', '2006-08-31 22:44:00'));
|
||||||
|
@ -5747,7 +5747,7 @@ Scholar.addOption("exportNotes", true);
|
||||||
|
|
||||||
function detectImport() {
|
function detectImport() {
|
||||||
var line;
|
var line;
|
||||||
while(line = Scholar.read()) {
|
while((line = Scholar.read()) !== "false") {
|
||||||
line = line.replace(/^\s+/, "");
|
line = line.replace(/^\s+/, "");
|
||||||
if(line != "") {
|
if(line != "") {
|
||||||
if(line.substr(0, 6) == "TY - ") {
|
if(line.substr(0, 6) == "TY - ") {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user