summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-03-16 15:33:42 +0000
committerAndrew Morgan <andrew@amorgan.xyz>2020-03-16 15:33:42 +0000
commitf39a91708fd3338280a4d140ee6af055878fa81e (patch)
tree7b145522def152a6277992ef4cc4c46b0d5d81ae
parentAdd CI for synapse_port_db (#6140) (diff)
parentMerge pull request #6268 from matrix-org/erikj/case_insensitive_room_dir (diff)
downloadsynapse-f39a91708fd3338280a4d140ee6af055878fa81e.tar.xz
Merge pull request #6268 from matrix-org/erikj/case_insensitive_room_dir
* commit '1652c8c1f':
  Add comment as to why we're pinning black in tests
  Pin black version
  Newsfile
  Make room directory search case insensitive
-rw-r--r--changelog.d/6286.bugfix1
-rw-r--r--synapse/storage/data_stores/main/room.py12
-rw-r--r--tox.ini2
3 files changed, 10 insertions, 5 deletions
diff --git a/changelog.d/6286.bugfix b/changelog.d/6286.bugfix
new file mode 100644
index 0000000000..a4bebec1c7
--- /dev/null
+++ b/changelog.d/6286.bugfix
@@ -0,0 +1 @@
+Fix bug where room directory search was case sensitive.
diff --git a/synapse/storage/data_stores/main/room.py b/synapse/storage/data_stores/main/room.py
index b478ee19fd..edc8b10ab1 100644
--- a/synapse/storage/data_stores/main/room.py
+++ b/synapse/storage/data_stores/main/room.py
@@ -204,13 +204,17 @@ class RoomWorkerStore(SQLBaseStore):
             where_clauses.append(
                 """
                     (
-                        name LIKE ?
-                        OR topic LIKE ?
-                        OR canonical_alias LIKE ?
+                        LOWER(name) LIKE ?
+                        OR LOWER(topic) LIKE ?
+                        OR LOWER(canonical_alias) LIKE ?
                     )
                 """
             )
-            query_args += [search_term, search_term, search_term]
+            query_args += [
+                search_term.lower(),
+                search_term.lower(),
+                search_term.lower(),
+            ]
 
         where_clause = ""
         if where_clauses:
diff --git a/tox.ini b/tox.ini
index 2c0629d291..11ecb2d26c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -114,7 +114,7 @@ skip_install = True
 basepython = python3.6
 deps =
     flake8
-    black==19.3b0
+    black==19.3b0  # We pin so that our tests don't start failing on new releases of black.
 commands =
     python -m black --check --diff .
     /bin/sh -c "flake8 synapse tests scripts scripts-dev scripts/hash_password scripts/register_new_matrix_user scripts/synapse_port_db synctl {env:PEP8SUFFIX:}"