From c56362aba30a3ae35312db3ca6222249b063e71d Mon Sep 17 00:00:00 2001 From: Holger Voormann Date: Wed, 5 Nov 2014 08:41:56 +0100 Subject: [PATCH] [FIXED JENKINS-22514] In ZIP archives file separator must be '/' --- .../src/main/java/hudson/model/DirectoryBrowserSupport.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java index 5fa073478a..cf803fcdc5 100644 --- a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java +++ b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java @@ -354,7 +354,11 @@ public final class DirectoryBrowserSupport implements HttpResponse { } else { relativePath = n; } - ZipEntry e = new ZipEntry(relativePath); + // In ZIP archives "All slashes MUST be forward slashes" (http://pkware.com/documents/casestudies/APPNOTE.TXT) + // TODO On Linux file names can contain backslashes which should not treated as file separators. + // Unfortunately, only the file separator char of the master is known (File.separatorChar) + // but not the file separator char of the (maybe remote) "dir". + ZipEntry e = new ZipEntry(relativePath.replace('\\', '/')); VirtualFile f = dir.child(n); e.setTime(f.lastModified()); zos.putNextEntry(e);