First round of bugfixes after the opening of the public beta!
- New words in the dictionary - Bugs fixed in HTML Checker tag stack which rejected <IMG> and <LI> and had a potential infinite loop - Multipart handling now handles Windows-uploaded filenames correctly - Bug fixed in PostOperations that was causing nuke to fail and scribble and hide to succeed but throw an internal servlet error - Enhanced conference listing now gives a better activity report in conferences - Top Content font enlarged - Null posts now work (they used to in WebbMe) - Slippage display corrected - Probably a couple of other things I can't think of just now.
This commit is contained in:
@@ -172,12 +172,49 @@ public class ServletMultipartHandler
|
||||
|
||||
// Parse the Content-Disposition header.
|
||||
String[] cdstr = part.getHeader("Content-Disposition");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Content-Disposition is " + cdstr[0]);
|
||||
ContentDisposition cdisp = new ContentDisposition(cdstr[0]);
|
||||
name = cdisp.getParameter("name");
|
||||
filename = cdisp.getParameter("filename");
|
||||
|
||||
if (filename!=null)
|
||||
{ // Strip off everything but the base filename, if the browser happened to pass that.
|
||||
{ // EJB 4/4/2001 - Windows boxes pass the filename complete with the backslashed pathname on the
|
||||
// front, and, for some reason, ContentDisposition strips out the backslashes while leaving the
|
||||
// pathname components in place (including the drive letter!). So we have to go to manual here
|
||||
// to extract the filename ourselves.
|
||||
int pos = cdstr[0].indexOf("filename");
|
||||
pos += 8;
|
||||
while ((cdstr[0].charAt(pos)==' ') || (cdstr[0].charAt(pos)=='\t'))
|
||||
pos++;
|
||||
if (cdstr[0].charAt(pos)!='=')
|
||||
throw new RuntimeException("must have = sign after filename");
|
||||
pos++;
|
||||
while ((cdstr[0].charAt(pos)==' ') || (cdstr[0].charAt(pos)=='\t'))
|
||||
pos++;
|
||||
if ((cdstr[0].charAt(pos)=='\'') || (cdstr[0].charAt(pos)=='"'))
|
||||
{ // filename enclosed in quotes...
|
||||
char match = cdstr[0].charAt(pos++);
|
||||
filename = cdstr[0].substring(pos);
|
||||
pos = filename.lastIndexOf(match);
|
||||
if (pos<0)
|
||||
throw new RuntimeException("must have closing quote");
|
||||
filename = filename.substring(0,pos);
|
||||
|
||||
} // end if
|
||||
else
|
||||
{ // no quotes, just take the rest of the line
|
||||
filename = cdstr[0].substring(pos);
|
||||
pos = filename.lastIndexOf(';');
|
||||
if (pos>=0)
|
||||
filename = filename.substring(0,pos);
|
||||
|
||||
} // end else
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Raw filename: " + filename);
|
||||
|
||||
// Strip off everything but the base filename, if the browser happened to pass that.
|
||||
int sep = filename.lastIndexOf('\\');
|
||||
if (sep>=0)
|
||||
filename = filename.substring(sep+1);
|
||||
|
||||
Reference in New Issue
Block a user