From 32320e8d06831c2d13feb7238db0aed0c073ba2d Mon Sep 17 00:00:00 2001 From: kohsuke Date: Mon, 13 Aug 2007 04:58:13 +0000 Subject: [PATCH] zip handling bug fix. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@4255 71c3de6d-444a-0410-be80-ed276b4c234a --- .../java/hudson/model/DirectoryBrowserSupport.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java index 159b606229..dfe9c0b8fa 100644 --- a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java +++ b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java @@ -86,7 +86,7 @@ public final class DirectoryBrowserSupport { // and the GLOB portion "**/*.xml" (the rest) StringBuilder _base = new StringBuilder(); StringBuilder _rest = new StringBuilder(); - int restSize=-1; // number of ".." needed to go back to the 'base' level + int restSize=-1; // number of ".." needed to go back to the 'base' level. boolean zip=false; // if we are asked to serve a zip file bundle { boolean inBase = true; @@ -118,7 +118,13 @@ public final class DirectoryBrowserSupport { FilePath baseFile = new FilePath(root,base); if(baseFile.isDirectory()) { - if(!zip && rest.length()==0) { + if(zip) { + rsp.setContentType("application/zip"); + baseFile.createZipArchive(rsp.getOutputStream()); + return; + } + + if(rest.length()==0) { // if the target page to be displayed is a directory and the path doesn't end with '/', redirect StringBuffer reqUrl = req.getRequestURL(); if(reqUrl.charAt(reqUrl.length()-1)!='/') {