Edgewall Software

Opened 4 years ago

Closed 4 years ago

#13192 closed defect (fixed)

KeyError for Query.get_modes().get(...)

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.5
Component: query system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed KeyError in log file due to invalid query filter request.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Found in log files:

2019-08-13 03:56:35,690 Trac[main] ERROR: [] Internal Server Error: <RequestWithSession "POST '/query'">, referrer 'https://bugs.jqueryui.com/'
Traceback (most recent call last):
  File "/var/www/bugs.jqueryui.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 648, in _dispatch_request
  File "/var/www/bugs.jqueryui.com/private/pve/local/lib/python2.7/site-packages/trac/web/main.py", line 249, in dispatch
    resp = chosen_handler.process_request(req)
  File "/var/www/bugs.jqueryui.com/private/pve/local/lib/python2.7/site-packages/trac/ticket/query.py", line 941, in process_request
    constraints = self._get_constraints(req)
  File "/var/www/bugs.jqueryui.com/private/pve/local/lib/python2.7/site-packages/trac/ticket/query.py", line 1099, in _get_constraints
    modes = Query.get_modes().get(fields[field]['type'])
KeyError: u"paU7mLAp'))"

Attachments (0)

Change History (2)

comment:1 by Ryan J Ollos, 4 years ago

Description: modified (diff)

Proposed change:

  • trac/ticket/query.py

    diff --git a/trac/ticket/query.py b/trac/ticket/query.py
    index 1f3883b78..274d0706d 100644
    a b class QueryModule(Component):  
    10941094            if add_num is not None:
    10951095                field = req.args.get('add_filter_' + add_num,
    10961096                                     req.args.get('add_clause_' + add_num))
    1097                 if field:
     1097                if field and field in fields:
    10981098                    clause = constraints.setdefault(int(add_num), {})
    10991099                    modes = Query.get_modes().get(fields[field]['type'])
    11001100                    mode = modes[0]['value'] if modes else ''

comment:2 by Ryan J Ollos, 4 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r17064, merged to trunk in r17065.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.