walker_callback: fix traceback on empty payload.
A previous commit of mine here tried to apply a trivial fix to avoid a warning on empty content type. Instead, it made the empty content type call a handler which did not exist. This instead logs warning on unknown non-empty payload. It logs debug on empty payload.
This commit is contained in:
parent
fc3bafe528
commit
5f358050ce
@ -165,7 +165,10 @@ def walker_callback(pdata, ctype, filename, payload):
|
|||||||
walker_handle_handler(pdata, ctype, filename, payload)
|
walker_handle_handler(pdata, ctype, filename, payload)
|
||||||
return
|
return
|
||||||
handlers = pdata['handlers']
|
handlers = pdata['handlers']
|
||||||
if ctype not in pdata['handlers'] and payload:
|
if ctype in pdata['handlers']:
|
||||||
|
run_part(handlers[ctype], pdata['data'], ctype, filename,
|
||||||
|
payload, pdata['frequency'])
|
||||||
|
elif payload:
|
||||||
# Extract the first line or 24 bytes for displaying in the log
|
# Extract the first line or 24 bytes for displaying in the log
|
||||||
start = _extract_first_or_bytes(payload, 24)
|
start = _extract_first_or_bytes(payload, 24)
|
||||||
details = "'%s...'" % (start.encode("string-escape"))
|
details = "'%s...'" % (start.encode("string-escape"))
|
||||||
@ -176,8 +179,7 @@ def walker_callback(pdata, ctype, filename, payload):
|
|||||||
LOG.warning("Unhandled unknown content-type (%s) userdata: %s",
|
LOG.warning("Unhandled unknown content-type (%s) userdata: %s",
|
||||||
ctype, details)
|
ctype, details)
|
||||||
else:
|
else:
|
||||||
run_part(handlers[ctype], pdata['data'], ctype, filename,
|
LOG.debug("empty payload of type %s" % ctype)
|
||||||
payload, pdata['frequency'])
|
|
||||||
|
|
||||||
|
|
||||||
# Callback is a function that will be called with
|
# Callback is a function that will be called with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user