karma: don't create a key > len(200)

should resolve bss/dr.botzo#9
This commit is contained in:
Brian S. Stephan 2017-02-11 18:01:44 -06:00
parent d63f2896ee
commit c8d084f9ff
1 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,11 @@ class Karma(Plugin):
key = match[0] if match[0] else match[1]
value = match[2]
log.debug("key length: %d", len(key))
if len(key) > KarmaKey._meta.get_field('key').max_length:
log.warning("given a key longer than %d, ignoring", KarmaKey._meta.get_field('key').max_length)
return
karma_key, c = KarmaKey.objects.get_or_create(key=key)
if value == '++':