0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 18:13:54 +01:00

Drop search values with nul characters

https://github.com/matrix-org/synapse/issues/2187 contains a report of a port
failing due to nul characters somewhere in the search table. Let's try dropping
the offending rows.
This commit is contained in:
Richard van der Hoff 2017-10-02 00:53:32 +01:00
parent bf86a41ef1
commit 7fc1aad195

View file

@ -376,10 +376,13 @@ class Porter(object):
" VALUES (?,?,?,?,to_tsvector('english', ?),?,?)" " VALUES (?,?,?,?,to_tsvector('english', ?),?,?)"
) )
rows_dict = [ rows_dict = []
dict(zip(headers, row)) for row in rows:
for row in rows d = dict(zip(headers, row))
] if "\0" in d['value']:
logger.warn('dropping search row %s', d)
else:
rows_dict.append(d)
txn.executemany(sql, [ txn.executemany(sql, [
( (