From c0e468b54387e8d40b245040004c3cb1d4f7cdf2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 29 Jul 2018 19:25:14 +0100 Subject: [PATCH] apply PR feedback Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- synapse/api/filtering.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 583daea906..c8c55bc061 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -12,11 +12,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + from synapse.api.errors import SynapseError from synapse.storage.presence import UserPresenceState from synapse.types import UserID, RoomID from twisted.internet import defer +import six import ujson as json import jsonschema from jsonschema import FormatChecker @@ -353,10 +355,8 @@ class Filter(object): ev_type = event.get("type", None) content = event.get("content", {}) - is_url = ( - "url" in content - and isinstance(content["url"], basestring) - ) + # check if there is a string url field in the content for filtering purposes + is_url = isinstance(content.get("url"), six.text_type) return self.check_fields( room_id,