Remove trailing slashes from outbound federation requests

This commit is contained in:
Andrew Morgan 2019-03-08 16:55:52 +00:00
parent 39e57f9728
commit 525dd02bbe

View file

@ -51,7 +51,7 @@ class TransportLayerClient(object):
logger.debug("get_room_state dest=%s, room=%s", logger.debug("get_room_state dest=%s, room=%s",
destination, room_id) destination, room_id)
path = _create_v1_path("/state/%s/", room_id) path = _create_v1_path("/state/%s", room_id)
return self.client.get_json( return self.client.get_json(
destination, path=path, args={"event_id": event_id}, destination, path=path, args={"event_id": event_id},
) )
@ -73,7 +73,7 @@ class TransportLayerClient(object):
logger.debug("get_room_state_ids dest=%s, room=%s", logger.debug("get_room_state_ids dest=%s, room=%s",
destination, room_id) destination, room_id)
path = _create_v1_path("/state_ids/%s/", room_id) path = _create_v1_path("/state_ids/%s", room_id)
return self.client.get_json( return self.client.get_json(
destination, path=path, args={"event_id": event_id}, destination, path=path, args={"event_id": event_id},
) )
@ -95,7 +95,7 @@ class TransportLayerClient(object):
logger.debug("get_pdu dest=%s, event_id=%s", logger.debug("get_pdu dest=%s, event_id=%s",
destination, event_id) destination, event_id)
path = _create_v1_path("/event/%s/", event_id) path = _create_v1_path("/event/%s", event_id)
return self.client.get_json(destination, path=path, timeout=timeout) return self.client.get_json(destination, path=path, timeout=timeout)
@log_function @log_function
@ -121,7 +121,7 @@ class TransportLayerClient(object):
# TODO: raise? # TODO: raise?
return return
path = _create_v1_path("/backfill/%s/", room_id) path = _create_v1_path("/backfill/%s", room_id)
args = { args = {
"v": event_tuples, "v": event_tuples,
@ -167,7 +167,7 @@ class TransportLayerClient(object):
# generated by the json_data_callback. # generated by the json_data_callback.
json_data = transaction.get_dict() json_data = transaction.get_dict()
path = _create_v1_path("/send/%s/", transaction.transaction_id) path = _create_v1_path("/send/%s", transaction.transaction_id)
response = yield self.client.put_json( response = yield self.client.put_json(
transaction.destination, transaction.destination,
@ -959,7 +959,7 @@ def _create_v1_path(path, *args):
Example: Example:
_create_v1_path("/event/%s/", event_id) _create_v1_path("/event/%s", event_id)
Args: Args:
path (str): String template for the path path (str): String template for the path
@ -980,7 +980,7 @@ def _create_v2_path(path, *args):
Example: Example:
_create_v2_path("/event/%s/", event_id) _create_v2_path("/event/%s", event_id)
Args: Args:
path (str): String template for the path path (str): String template for the path