Skip to content

Commit

Permalink
#2438 Fix FilePage redirect when no shoulder and dependent identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed May 14, 2018
1 parent 3575b0d commit 45d3963
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/main/java/edu/harvard/iq/dataverse/DataFileServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,35 @@ public DataFile findByGlobalId(String globalId){
authority = globalId.substring(index1 + 1, index2);
}
if (protocol.equals("doi")) {

index3 = globalId.indexOf(separator, index2 + 1);
if (index3 == -1 ) {
identifier = globalId.substring(index2 + 1); //.toUpperCase();
String doiDataFileFormat = settingsService.getValueForKey(SettingsServiceBean.Key.DataFilePIDFormat, "DEPENDENT");
if (!doiDataFileFormat.equals(SystemConfig.DataFilePIDFormat.DEPENDENT.toString())) {
index3 = globalId.indexOf(separator, index2 + 1);
if (index3 == -1) {
identifier = globalId.substring(index2 + 1); //.toUpperCase();
} else {
if (index3 > -1) {
authority = globalId.substring(index1 + 1, index3);
identifier = globalId.substring(index3 + 1).toUpperCase();
}
}
} else {
if (index3 > -1) {
authority = globalId.substring(index1 + 1, index3);
identifier = globalId.substring(index3 + 1).toUpperCase();
index3 = globalId.indexOf(separator, index2 + 1);
int index4 = globalId.indexOf("/", index3 + 1);
if (index4 == -1) {
identifier = globalId.substring(index2 + 1); //.toUpperCase();
} else {
if (index4 > -1) {
authority = globalId.substring(index2 + 1, index3);
identifier = globalId.substring(index3 + 1).toUpperCase();
}
}

}

} else {
identifier = globalId.substring(index2 + 1).toUpperCase();
}

DataFile file = null;
try {
file = (DataFile) em.createNamedQuery("DataFile.findDataFileByIdProtocolAuth")
Expand Down

0 comments on commit 45d3963

Please sign in to comment.