Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 95224 invoked by uid 500); 23 Sep 2002 19:27:23 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 95213 invoked from network); 23 Sep 2002 19:27:23 -0000 Message-ID: <20020923192728.41513.qmail@web40514.mail.yahoo.com> Date: Mon, 23 Sep 2002 12:27:28 -0700 (PDT) From: Geoff Howard Subject: Re: Bug in MultipartParser? To: cocoon-dev@xml.apache.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org