Edgewall Software

Changes between Initial Version and Version 1 of Ticket #12017


Ignore:
Timestamp:
Apr 13, 2015, 6:44:59 AM (9 years ago)
Author:
Jun Omae
Comment:

No. That is not a SpamFilter issue. We can raise the same error on any components, e.g. /wiki?name=%FF, /query?name=%FF.

  • trac/web/api.py

    diff --git a/trac/web/api.py b/trac/web/api.py
    index 3944020..0e62804 100644
    a b class Request(object):  
    702702            self.environ['QUERY_STRING'] = qs_on_post
    703703
    704704        args = []
    705         for value in fs.list or ():
    706             name = value.name
    707             if not value.filename:
    708                 value = unicode(value.value, 'utf-8')
    709             args.append((name, value))
     705        try:
     706            for value in fs.list or ():
     707                name = value.name
     708                if not value.filename:
     709                    value = unicode(value.value, 'utf-8')
     710                args.append((name, value))
     711        except UnicodeDecodeError, e:
     712            raise HTTPBadRequest(_("Invalid encoding in form data: %(msg)s",
     713                                   msg=exception_to_unicode(e)))
    710714        return args
    711715
    712716    def _parse_cookies(self):

After the patch, the following without traceback would be logged by invalid enoding.

2015-04-13 13:35:57,989 Trac[main] WARNING: [192.168.11.24] HTTPBadRequest: 400 Bad Request (Invalid encoding in form data: UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: unexpected code byte)

I noticed that /wiki?%FF=xxxx doesn't lead the same error. I think we should decode the names to unicode with utf-8 encoding.

-            name = value.name
+            name = unicode(value.name, 'utf-8')

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12017

    • Property Component plugin/spamfiltergeneral
  • Ticket #12017 – Description

    initial v1  
    11Running the latest SpamFilter plugin [13942], I find the following errors in the log:
    2 {{{#!pycon
     2{{{
    332015-04-01 23:15:33,851 Trac[main] ERROR: Internal Server Error:
    44Traceback (most recent call last):