on 1/3/2001 11:46 PM, "Youngho Cho" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In Case of <input type = "file" name=""> ,
> The TurbineUploadService makes unnecessary FileItem for null attachment file
> name.
>
> TurbineUploadService.java
> Line 221 - 241
>
> /**
> * <p> Retrieves file name from 'Content-disposition' header.
> *
> * @return A String with the file name for the current
> * <code>encapsulation</code>.
> */
> protected String getFileName()
> {
> String cd = getHeader("Content-disposition");
> if(!cd.startsWith("form-data") && !cd.startsWith("attachment"))
> return null;
> int start = cd.indexOf("filename=\"");
> int end = cd.indexOf('"', start+10);
> if(start == -1 || end == -1)
> return null;
> + String str = cd.substring(start+10,end).trim();
> + if( str.length() == 0)
> + return null;
> + else
> + return str;
> - return cd.substring(start+10,end);
> }
> Thanks,
Ok, a couple of things.
#1. DO NOT SEND HTML EMAIL. Please.
#2. It seems that we should have more checks to make sure that we don't get
an indexoutofboundsexception on the substring().
Please submit a better patch.
thx.
-jon
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]