forked from rDrama/rDrama
fix snappy dupe detection
parent
4a3c4e03ce
commit
8b5bf42b54
|
@ -228,11 +228,14 @@ def comment(v):
|
||||||
else:
|
else:
|
||||||
abort(415)
|
abort(415)
|
||||||
|
|
||||||
body = body.replace('\n ', '\n')
|
body = body.replace('\n ', '\n').replace('\r', '')
|
||||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT]
|
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT].strip()
|
||||||
|
|
||||||
if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1 and body not in SNAPPY_QUOTES:
|
if v.admin_level >= PERMS['USE_ADMIGGER_THREADS'] and posting_to_post and post_target.id == SNAPPY_THREAD and level == 1:
|
||||||
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
|
with open(f"snappy_{SITE_NAME}.txt", "r+", encoding="utf-8") as f:
|
||||||
|
body_for_checking = '\n{[para]}\n' + body + '\n{[para]}\n'
|
||||||
|
if body_for_checking in f.read():
|
||||||
|
abort(400, "Snappy quote already exists!")
|
||||||
f.write('\n{[para]}\n' + body)
|
f.write('\n{[para]}\n' + body)
|
||||||
|
|
||||||
body_for_sanitize = body
|
body_for_sanitize = body
|
||||||
|
|
Loading…
Reference in New Issue