Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

#12269 closed defect (fixed)

TypeError: expected string or buffer

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Avoid traceback for duplicated arguments to trap fields.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Found the following in the logs:

2015-12-08 19:09:27,984 Trac[filtersystem] ERROR: Filter strategy <tracspamfilter.filters.trapfield.TrapFieldFilterStrategy object at 0x817990ac> raised exception: expected string or bufferTraceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filtersystem.py", line 192, in test
    retval = strategy.test(req, author, content, ip)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filters/trapfield.py", line 65, in test
    i = shorten_line(javascript_quote(i), 50)
  File "build/bdist.linux-i686/egg/trac/util/text.py", line 155, in javascript_quote
    return _js_quote_re.sub(replace, text)TypeError: expected string or buffer

I guess the issue is probably that a sequence other than a string is being passed to javascript_quote:

>>> javascript_quote([1, 2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/text.py", line 152, in javascript_quote
    return _js_quote_re.sub(replace, text)
TypeError: expected string or buffer

I wonder if this can happen through duplicated arguments (e.g. ?trap_field=1&trap_field=2).

Attachments (0)

Change History (7)

comment:1 by Ryan J Ollos, 9 years ago

Owner: changed from Dirk Stöcker to Ryan J Ollos
Status: newassigned

comment:2 by Ryan J Ollos, 9 years ago

DONE bump plugin version after this issue is resolved (comment:8:ticket:12133).

Version bumped in [14504]. I'll bump the version number more frequently in the future.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Ryan J Ollos, 9 years ago

Fixed failing test cases in [14413:14414,14416:11417].

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:4 by Ryan J Ollos, 9 years ago

#12215 closed as a duplicate, but will also look into the secondary issue noted in comment:2:ticket:12215:

2015-10-22 02:26:27,839 Trac[filtersystem] ERROR: Filter strategy <tracspamfilter.captcha.api.CaptchaSystem object at 0x829d9a8c> raised exception: connection already closed
Traceback (most recent call last):
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filtersystem.py", line 217, in test
    self._record_action('test','empty', '', strategy, tim)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/filtersystem.py", line 466, in _record_action
    stats.insert_or_update(name, action, data, status, delay, 1 if strategy.is_external() else 0)
  File "/srv/trac-hacks.org/pve/lib/python2.6/site-packages/TracSpamFilter-1.0.6.dev0-py2.6.egg/tracspamfilter/model.py", line 396, in insert_or_update
    delay, delay, external, int(time())))
  File "build/bdist.linux-i686/egg/trac/db/api.py", line 159, in __exit__
    self.db.rollback()
InterfaceError: connection already closed

comment:5 by Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:6 by Ryan J Ollos, 9 years ago

Description: modified (diff)

comment:7 by Ryan J Ollos, 9 years ago

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

Applied a fix in [14833]. As for comment:4, I cannot reproduce, but I'll revisit if I find the issue in the logs again.

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.