commit | e981a8c84bf2913d4168428b97ed5538da3acdf8 | [log] [tgz] |
---|---|---|
author | Jan Willem Janssen <jawi@apache.org> | Wed Jan 14 19:36:49 2015 +0000 |
committer | Jan Willem Janssen <jawi@apache.org> | Wed Jan 14 19:36:49 2015 +0000 |
tree | 98f2315980e0c5e6f5df0f2e090b0ffd5316b955 | |
parent | 850305682ead43ba044ebb853126de6c28cd2f95 [diff] |
FELIX-4719 - Fixed directory separator: - The ZIP specification mandates that *only* forward slashes to be used for separating directories. See section 4.4.17.1 of <https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>. git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1651784 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java index a233d55..29c2c2c 100644 --- a/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java +++ b/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/SnapshotCommand.java
@@ -38,6 +38,9 @@ import org.osgi.service.log.LogService; public class SnapshotCommand extends Command { + /** The ZIP specification mandates that directory-entries end with a forward slash (on all platforms). */ + static final String FORWARD_SLASH = "/"; + private final GetStorageAreaCommand m_getStorageAreaCommand; public SnapshotCommand(GetStorageAreaCommand getStorageAreaCommand) { @@ -162,7 +165,11 @@ else if (entry.isDirectory()) { String baseDir = ""; if (!"".equals(entryName)) { - baseDir = entryName.concat(File.separator); + baseDir = entryName; + // Directories *must* use forward slashes... + if (!baseDir.endsWith(FORWARD_SLASH)) { + baseDir = baseDir.concat(FORWARD_SLASH); + } output.putNextEntry(new ZipEntry(baseDir)); output.closeEntry();