Author: dbkr
Date: 2006-05-25 22:15:22 +0000 (Thu, 25 May 2006)
New Revision: 8872

Modified:
   trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
   trunk/freenet/src/freenet/node/Version.java
Log:
741: Fix bug 381 (freesites with multiple files of the same name cannot be 
inserted) by setting targetInZip to the full path of the file rather than just 
the filename.

This seems to me that it must be the intended behaviour, but please check to 
make sure that it is. Has been tested and appears to work.


Modified: trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2006-05-25 19:36:38 UTC (rev 8871)
+++ trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2006-05-25 22:15:22 UTC (rev 8872)
@@ -246,6 +246,10 @@
        }

        private void makePutHandlers(HashMap manifestElements, HashMap 
putHandlersByName) throws InserterException {
+               makePutHandlers(manifestElements, putHandlersByName, "/");
+       }
+       
+       private void makePutHandlers(HashMap manifestElements, HashMap 
putHandlersByName, String ZipPrefix) throws InserterException {
                Iterator it = manifestElements.keySet().iterator();
                while(it.hasNext()) {
                        String name = (String) it.next();
@@ -253,7 +257,7 @@
                        if(o instanceof HashMap) {
                                HashMap subMap = new HashMap();
                                putHandlersByName.put(name, subMap);
-                               makePutHandlers((HashMap)o, subMap);
+                               makePutHandlers((HashMap)o, subMap, 
ZipPrefix+name+"/");
                        } else {
                                ManifestElement element = (ManifestElement) o;
                                String mimeType = element.mimeOverride;
@@ -275,7 +279,7 @@
                                        // FIXME support better heuristics.
                                        if(data.size() <= 65536) { // totally 
dumb heuristic!
                                                // Put it in the zip.
-                                               ph = new PutHandler(name, 
element.fullName, cm, data);
+                                               ph = new PutHandler(name, 
ZipPrefix+element.fullName, cm, data);
                                                elementsToPutInZip.addLast(ph);
                                                numberOfFiles++;
                                                totalSize += data.size();

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-05-25 19:36:38 UTC (rev 
8871)
+++ trunk/freenet/src/freenet/node/Version.java 2006-05-25 22:15:22 UTC (rev 
8872)
@@ -18,7 +18,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 740;
+       private static final int buildNumber = 741;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 732;


Reply via email to