From: <ama...@us...> - 2006-03-01 18:09:40
|
Revision: 5707 Author: amaxwell Date: 2006-03-01 10:09:34 -0800 (Wed, 01 Mar 2006) ViewCVS: http://svn.sourceforge.net/bibdesk/?rev=5707&view=rev Log Message: ----------- Fix DOI resolution by removing doi: portion before resolving against http://dx.doi.org Modified Paths: -------------- trunk/bibdesk/BibItem.m Modified: trunk/bibdesk/BibItem.m =================================================================== --- trunk/bibdesk/BibItem.m 2006-03-01 17:48:06 UTC (rev 5706) +++ trunk/bibdesk/BibItem.m 2006-03-01 18:09:34 UTC (rev 5707) @@ -1648,9 +1648,14 @@ NSString *value = [pubFields objectForKey:field usingLock:bibLock]; NSURL *baseURL = nil; - // resolve DOI fields against a base URL if necessary, so they can be used directly - if([field isEqualToString:@"Doi"] && [value rangeOfString:@"://"].length == 0) + // resolve DOI fields against a base URL if necessary, so they can be opened directly by NSWorkspace + if([field isEqualToString:@"Doi"] && [value rangeOfString:@"://"].length == 0){ baseURL = [NSURL URLWithString:@"http://dx.doi.org/"]; + // remove the doi: prefix, which is required for a valid DOI, but may not be present + NSRange range = [value rangeOfString:@"doi:"]; + if(range.length) + value = [value substringFromIndex:NSMaxRange(range)]; + } return [NSURL URLWithStringByNormalizingPercentEscapes:value baseURL:baseURL]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |