On Monday, November 25, 2013 8:47:44 AM UTC-8, Jun Omae wrote: > > >>>>> I'm in agreement on the insane aspect of it, but it seems to work > just > >>>>> fine to create a file with a linefeed character on TracStandalone: > >>>>> > >>>>> $ echo "Some text" > "myfile > >>>>> " > >>>>> > >>>>> The linefeed character is encoded as %0A: myfile%0A > > This behavior depends on browser implementation. Firefox replaces > linefeed characters with spaces. I guess that you're using Google > Chrome. > > Firefox: > > http://hg.mozilla.org/mozilla-central/file/757c2011df5b/content/html/content/src/nsFormSubmission.cpp#l445 > > > http://hg.mozilla.org/mozilla-central/file/757c2011df5b/content/html/content/src/nsFormSubmission.cpp#l521 > > > http://hg.mozilla.org/mozilla-central/file/757c2011df5b/content/html/content/src/nsFormSubmission.cpp#l705 > > > Webkit: > > http://trac.webkit.org/browser/trunk/Source/WebCore/platform/network/FormDataBuilder.cpp?rev=159750#L163 > > > http://trac.webkit.org/browser/trunk/Source/WebCore/platform/network/FormDataBuilder.cpp?rev=159750#L56 > > > Also, Trac currently strips whitespaces from filename. Then, it would > be strip the linefeed character after "myfile". > > > http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/attachment.py?marks=715#L711 > > > > >> 1. Do not allow uploading such attachments at all > >> 2. Allow uploads and support new line chars in attachments web UI > >> 3. Keep things as they are now i.e. allow uploads and still fail to > >> match attachment web UI requests > >> > >> It seems to me that (1) is the best approach . > > 4. Replace unicode control codes with spaces. > > See attachment-ctrl-codes.diff. >
Either (4) or URL-encoding the control codes seems like a good approach. I think users will find it less frustrating than having their upload rejected, and I haven't heard any good cause for needing to reject the files when instead the filenames can just be fixed-up. Nice to see WebKit being hosted on Trac! -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-dev. For more options, visit https://groups.google.com/groups/opt_out.
