diff --git a/pom.xml b/pom.xml index f13e3dc..dd14e37 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 DVUploader DVUploader - 1.2.0 + 1.2.1 UTF-8 diff --git a/src/main/java/org/sead/uploader/dataverse/DVUploader.java b/src/main/java/org/sead/uploader/dataverse/DVUploader.java index 7794d90..ec1efa1 100644 --- a/src/main/java/org/sead/uploader/dataverse/DVUploader.java +++ b/src/main/java/org/sead/uploader/dataverse/DVUploader.java @@ -329,7 +329,8 @@ public String itemExists(String path, Resource item) { println("out:" + relPath); } - String sourcepath = item.getName(); + //Create a path/name string w/o an initial / + String sourcepath = (path.length()==1 ? "" : path.substring(1)) + item.getName(); // One-time: get metadata for dataset to see if it exists and what files it // contains @@ -440,9 +441,11 @@ public String itemExists(String path, Resource item) { @Override protected String verifyDataByHash(String tagId, String path, Resource item) { - JSONObject checksum = existingItems.get(item.getName()); + String sourcepath = (path.startsWith("/") ? "" : path) + item.getName(); + + JSONObject checksum = existingItems.get(sourcepath); if (!checksum.getString("value").equals(item.getHash(checksum.getString("type")))) { - hashIssues.put(path + item.getName(), "!!!: A different version of this item exists with ID: " + tagId); + hashIssues.put(sourcepath, "!!!: A different version of this item exists with ID: " + tagId); return null; } // else it matches! return tagId;