summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-10-02 00:53:32 +0100
committerRichard van der Hoff <richard@matrix.org>2017-10-02 00:53:32 +0100
commit7fc1aad195b01c4ffe990fc705ff61d128dc0190 (patch)
tree4e2eda7513a47d7c552fc5dfe346deea526dc0c1 /scripts
parentMerge pull request #2476 from matrix-org/erikj/joined_members_auth (diff)
downloadsynapse-7fc1aad195b01c4ffe990fc705ff61d128dc0190.tar.xz
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.
Diffstat (limited to 'scripts')
-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, [
                         (