Author: [log in to unmask] Date: Thu Oct 22 17:12:18 2015 New Revision: 3883 Log: Strip cache prefix from file names before entering in datacat. Modified: java/trunk/crawler/src/main/java/org/hps/crawler/DatacatUtilities.java Modified: java/trunk/crawler/src/main/java/org/hps/crawler/DatacatUtilities.java ============================================================================= --- java/trunk/crawler/src/main/java/org/hps/crawler/DatacatUtilities.java (original) +++ java/trunk/crawler/src/main/java/org/hps/crawler/DatacatUtilities.java Thu Oct 22 17:12:18 2015 @@ -55,9 +55,15 @@ static int addFile(final DatacatClient client, final String folder, final File file, final Map<String, Object> metadata, final DatasetFileFormat fileFormat, final DatasetDataType dataType, final DatasetSite site) { + + // Strip out cache dir prefix. + String filePath = file.getAbsolutePath(); + if (filePath.startsWith("/cache")) { + filePath = filePath.replace("/cache", ""); + } // Add the dataset to the data catalog using the REST API. - final int response = client.addDataset(folder, dataType, file.getAbsolutePath(), site, fileFormat, + final int response = client.addDataset(folder, dataType, filePath, file.length(), site, fileFormat, file.getName(), metadata); return response;