Skip to content

Commit dfd4eb2

Browse files
author
Wolfgang Walter SAUER
authored
Merge pull request #83 from clarin-eric/dev
Dev
2 parents b4fd3a7 + fb6750e commit dfd4eb2

File tree

8 files changed

+180
-141
lines changed

8 files changed

+180
-141
lines changed

curation-module-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<parent>
44
<artifactId>curation-module</artifactId>
55
<groupId>eu.clarin.cmdi</groupId>
6-
<version>5.0.5</version>
6+
<version>5.0.6</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>curation-module-core</artifactId>
10-
<version>5.0.5</version>
10+
<version>5.0.6</version>
1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1313
<slf4j.version>1.7.25</slf4j.version>
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>com.google.guava</groupId>
7272
<artifactId>guava</artifactId>
73-
<version>28.1-jre</version>
73+
<version>30.0-jre</version>
7474
</dependency>
7575
<dependency>
7676
<groupId>commons-cli</groupId>

curation-module-core/script/weeklyUpdate.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,21 @@ set -e
5151

5252
echo "generating new reports, downloading necessary profiles..."
5353
java $VM_ARGS -Dprojectname=curate $LOG4J -jar $BIN_DIR/curate.jar -config $CONF_DIR/config.properties -r -path $DATA_DIR/clarin/$CMDI_PATH $DATA_DIR/europeana/$CMDI_PATH
54-
echo "report generation finished. creating value maps..."
54+
echo "report generation finished."
5555

56-
# create value maps
57-
for name in resourceClass_tf-extended profileName2resourceClass_tf-extended_noResourceClassProfiles collection modality organisation; do
58-
curl -O https://raw.githubusercontent.com/acdh-oeaw/VLO-mapping/master/value-maps/$name.csv
59-
java -jar $BIN_DIR/vlo-mapping-creator.jar $name.csv > $WORK_DIR/value_maps/$name.xml
60-
rm $name.csv
61-
done
56+
if [ -e "$BIN_DIR/vlo-mapping-creator.jar" ]; then
57+
echo "creating value maps..."
58+
# create value maps
59+
for name in resourceClass_tf-extended profileName2resourceClass_tf-extended_noResourceClassProfiles collection modality organisation; do
60+
curl -O https://raw.githubusercontent.com/acdh-oeaw/VLO-mapping/master/value-maps/$name.csv
61+
java -jar "$BIN_DIR/vlo-mapping-creator.jar" $name.csv > $WORK_DIR/value_maps/$name.xml
62+
rm $name.csv
63+
done
64+
echo "Finished!"
65+
else
66+
echo "Skipping value map creation - mapping creator binary not found"
67+
fi
6268

63-
echo "Finished!"
6469
ELAPSED_TIME=$(($SECONDS - $START_TIME))
6570
echo "Elapsed time: $(($ELAPSED_TIME/60)) min"
6671
echo "please restart curate webapp with 'docker-manage -e clarin-curate -v'"

curation-module-core/src/main/java/eu/clarin/cmdi/curation/main/Configuration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ private static void readProperties(Properties config) throws IOException {
138138

139139
USERAGENT = config.getProperty("USERAGENT");
140140
BASE_URL = config.getProperty("BASE_URL");
141+
if(!BASE_URL.endsWith("/"))
142+
BASE_URL += "/";
141143
}
142144

143145
public static class StormycheckerConstants{

curation-module-core/src/main/java/eu/clarin/cmdi/curation/report/CMDInstanceReport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static class URLElement {
9999
public String message;
100100

101101
@XmlAttribute(name = "http-status")
102-
public int status;
102+
public Integer status;
103103

104104
@XmlAttribute(name = "content-type")
105105
public String contentType;
@@ -201,9 +201,8 @@ private static synchronized void mergeWithParent(CollectionReport parentReport,
201201
parentReport.xmlValidationReport.record.add(record);
202202
}
203203

204-
205-
parentReport.urlReport.totNumOfLinks += instanceReport.urlReport.numOfLinks;
206204
//will be done through database
205+
parentReport.urlReport.totNumOfLinks += instanceReport.urlReport.numOfLinks;
207206
// parentReport.urlReport.totNumOfBrokenLinks += instanceReport.urlReport.numOfBrokenLinks;
208207
// parentReport.urlReport.totNumOfCheckedLinks += instanceReport.urlReport.numOfCheckedLinks;
209208

curation-module-web/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>eu.clarin.cmdi</groupId>
88
<artifactId>curation-module</artifactId>
9-
<version>5.0.5</version>
9+
<version>5.0.6</version>
1010
</parent>
1111

1212
<modelVersion>4.0.0</modelVersion>
@@ -81,7 +81,7 @@
8181
<dependency>
8282
<groupId>eu.clarin.cmdi</groupId>
8383
<artifactId>curation-module-core</artifactId>
84-
<version>5.0.5</version>
84+
<version>5.0.6</version>
8585
<scope>compile</scope>
8686
</dependency>
8787
</dependencies>

curation-module-web/src/main/java/eu/clarin/routes/Record.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import java.io.ByteArrayInputStream;
1515
import java.io.ByteArrayOutputStream;
1616
import java.io.IOException;
17+
import java.nio.file.LinkOption;
18+
import java.nio.file.Paths;
1719

1820
//this route is to make records available to view
1921
@Path("/record")
@@ -23,7 +25,12 @@ public class Record {
2325
@Path("/{filepath : .+}")
2426
public Response handleView(@PathParam("filepath") String filePath) {
2527
try {
26-
String file = FileManager.readFile(Configuration.RECORDS_PATH + "/" + filePath);
28+
// the next three lines assure that the path is a sub-path of RECORDS_PATH
29+
java.nio.file.Path path = Paths.get(Configuration.RECORDS_PATH, filePath).toRealPath(LinkOption.NOFOLLOW_LINKS);
30+
if(!path.startsWith(Configuration.RECORDS_PATH))
31+
return ResponseManager.returnError(404, "Path not permitted.");
32+
33+
String file = FileManager.readFile(path.toString());
2734
return ResponseManager.returnResponse(200, file, MediaType.TEXT_XML);
2835

2936
} catch (IOException e) {

0 commit comments

Comments
 (0)