summary refs log tree commit diff
path: root/scripts/synapse_port_db
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2017-10-03 13:49:05 +0100
committerGitHub <noreply@github.com>2017-10-03 13:49:05 +0100
commite4779be97ac3e9b6cc8ac88f891d1a48c1dc5de4 (patch)
treede2d4759676ef7a1e5495b484cf75437f2031b89 /scripts/synapse_port_db
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
parentDrop search values with nul characters (diff)
downloadsynapse-e4779be97ac3e9b6cc8ac88f891d1a48c1dc5de4.tar.xz
Merge pull request #2491 from matrix-org/rav/port_db_fixes
Drop search values with nul characters
Diffstat (limited to 'scripts/synapse_port_db')
-rwxr-xr-xscripts/synapse_port_db11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/synapse_port_db b/scripts/synapse_port_db
index bc167b59af..dc7fe940e8 100755
--- a/scripts/synapse_port_db
+++ b/scripts/synapse_port_db
@@ -376,10 +376,13 @@ class Porter(object):
                         " VALUES (?,?,?,?,to_tsvector('english', ?),?,?)"
                     )
 
-                    rows_dict = [
-                        dict(zip(headers, row))
-                        for row in rows
-                    ]
+                    rows_dict = []
+                    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, [
                         (