Don't save non-empty folders. Enforce relative URIs
diff --git a/src/main/java/org/purl/wf4ever/robundle/manifest/Manifest.java b/src/main/java/org/purl/wf4ever/robundle/manifest/Manifest.java
index 798ad4a..db76f5f 100644
--- a/src/main/java/org/purl/wf4ever/robundle/manifest/Manifest.java
+++ b/src/main/java/org/purl/wf4ever/robundle/manifest/Manifest.java
@@ -182,6 +182,7 @@
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
+ potentiallyEmptyFolders.remove(withSlash(file.getParent()));
if (file.startsWith(MIMETYPE)) {
return FileVisitResult.CONTINUE;
}
@@ -267,11 +268,11 @@
public PathMetadata getAggregation(Path file) {
URI fileUri = file.toUri();
- fileUri = ROOT.resolve(file.getRoot().toUri().relativize(fileUri));
return getAggregation(fileUri);
}
public PathMetadata getAggregation(URI uri) {
+ uri = relativeToBundleRoot(uri);
for (PathMetadata meta : getAggregates()) {
if (uri.equals(meta.getUri()) || uri.equals(meta.getProxy())) {
return meta;
@@ -282,4 +283,9 @@
}
return null;
}
+
+ private URI relativeToBundleRoot(URI uri) {
+ uri = ROOT.resolve(bundle.getRoot().toUri().relativize(uri));
+ return uri;
+ }
}