I had just started to look for a solution when I saw
your (Vadim's) patch (inline below).  It looks like no
one has tried the patch yet (at least on list), so I
did.  It's failing to compile because fileName is
declared multiple times.  In the patched version, it's
on lines 236 and 243.  Simply removing the String
declaration from line 243 so that it reads: 
      fileName = new File(fileName).getName();
seems to correct the problem - it compiles and works
(after removing the cocoon work directory).

The disclaimer - I only tested this with the following
setup:

Cocoon: HEAD
running on: Tomcat 4.0.4 running on linux
JDK: 1.4
Browser running from: Win2k (IE 5.5), Redhat linux
(links - commandline only)

Having said that, I don't see anything in the nature
of the patch that should arouse a lot of suspicion on
other configurations.

Thanks for your work,
Geoff Howard

Original Patch:

Index: MultipartParser.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/components/request/multipart/MultipartParser.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 MultipartParser.java
--- MultipartParser.java        23 May 2002 12:01:46 -0000
1.1.2.2
+++ MultipartParser.java        20 Sep 2002 12:28:35 -0000
@@ -233,11 +233,14 @@
         if (!saveUploadedFilesToDisk) {
             out = new ByteArrayOutputStream();
         } else {
-            String filePath =
uploadDirectory.getPath() + File.separator;
-       
-            String fileName =
-                    new File((String)
headers.get("filename")).getName();
+            String fileName = (String)
headers.get("filename");
+            if(File.separatorChar == '\\')
+                fileName =
fileName.replace('/','\\');
+            else
+                fileName =
fileName.replace('\\','/');
 
+            String filePath =
uploadDirectory.getPath() + File.separator;
+            String fileName = new
File(fileName).getName();
             file = new File(filePath + fileName);
 
             if (file.exists()) {


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to