[Simpleweb-Support] Upload file name issue - part 2
Brought to you by:
niallg
From: Andrew B. <and...@de...> - 2012-04-14 10:33:32
|
I think the issue can be fixed with the following amendments to DispositionParser.java, which ensures that the value is only terminated by a matching character. I haven't run the full test harness with this fix in place but I did make amendments to DispositionParserTest to verify it worked for a number of use cases. I'm not sure if you're actively developing Simple, but this may be worth including - unless there's a better solution; this may be a bit naive. Regards, AndyB /** * This is used to read a parameters value from the buf. This will read all * <code>char</code>'s upto but excluding the first terminal <code>char</code> * encountered from the off within the buf, or if the value is a literal * it will read a literal from the buffer (literal is any data between * quotes except if the quote is prefixed with a backward slash character). * * @param value */ private void value(ParseBuffer value) { if (quote(buf[off])) { char endquote = buf[off]; for (off++; off < count; ) { if (endquote == buf[off]) { if (buf[++off - 2] != '\\') { break; } } value.append(buf[off++]); } } else { while (off < count) { if (buf[off] == ';') { break; } value.append(buf[off]); off++; } } } Andy Barlow - IT Consultant - MBCS CENG EURING CITP e: and...@de... t: +44 (0)7830 302 268 The information in this email or facsimile is confidential and is intended solely for the addressee(s) and access to this email or facsimile by anyone else is unauthorised. If you are not the intended recipient then any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Information expressed in this email or facsimile is not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independent of this message. |