cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry DuVal" <>
Subject Multipart Parser bug with multiple FileParts named the same name
Date Wed, 16 Apr 2008 14:11:27 GMT
Is this a bug?

When a MultipartHttpServletRequest parses the values using MultipartParser
it puts the Inline Parts into a Vector, but when parsing FileParts it just
puts them into the "parts" hashtable.  The problem with this is when a
Request has multiple FileParts named the same, the parsed parts for the
FilePart will always be the value of the last parsed FilePart.  Using the
example HTML below, if you attached different files to for each row,
the MultipartParser would only have 1 value for ( the value from the
second row ) instead of a vector.  Let me know what you think, I can create
a patch. 

Example HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns:page=""
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <form method="post" name="appboxForm"
            <table id="All">
                            <input name="All.primaryKey" type="hidden"
                            <input name="" class="filefield"
type="file" id="d1508e107"/>
                            <input name="All.primaryKey" type="hidden"
                            <input name="" class="filefield"
type="file" id="d1508e144"/>
            <input name="appbox-continuation-id" type="hidden"
            <input type="hidden" name="appbox_currentTab"
id="appbox_currentTab" value="0"/>

private void parseFilePart(TokenStream in, Hashtable headers) IOException,

At the bottom of the method

        String name = (String)headers.get("name");
        if (oversized) {
  , new RejectedPart(headers, length,
this.contentLength, this.maxUploadSize));
        } else if (file == null) {
            byte[] bytes = ((ByteArrayOutputStream) out).toByteArray();
  , new PartInMemory(headers, bytes));
        } else {
  , new PartOnDisk(headers, file));

Thanks in Advance,

Jerry DuVal
Pace Systems Group, Inc.

View raw message