Skip to content

Commit

Permalink
Add missing room/event ID quotings
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Feb 13, 2019
1 parent db34c2f commit 21bb087
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mautrix_appservice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from .state_store import StateStore
from .intent_api import IntentAPI

__version__ = "0.3.7"
__version__ = "0.3.8"
__author__ = "Tulir Asokan <[email protected]>"
12 changes: 7 additions & 5 deletions mautrix_appservice/intent_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,8 @@ async def set_power_levels(self, room_id: str, content: dict, **kwargs) -> dict:

async def get_pinned_messages(self, room_id: str) -> List[str]:
await self.ensure_joined(room_id)
response = await self.client.request("GET", f"/rooms/{room_id}/state/m.room.pinned_events")
response = await self.client.request("GET",
f"/rooms/{quote(room_id)}/state/m.room.pinned_events")
return response["content"]["pinned"]

def set_pinned_messages(self, room_id: str, events: List[str], **kwargs) -> Awaitable[dict]:
Expand Down Expand Up @@ -635,7 +636,7 @@ async def get_member_info(self, room_id: str, user_id: str, ignore_cache=False)

async def get_event(self, room_id: str, event_id: str) -> dict:
await self.ensure_joined(room_id)
return await self.client.request("GET", f"/rooms/{room_id}/event/{event_id}")
return await self.client.request("GET", f"/rooms/{quote(room_id)}/event/{quote(event_id)}")

async def set_typing(self, room_id: str, is_typing: bool = True, timeout: int = 5000,
ignore_cache: bool = False) -> Optional[dict]:
Expand All @@ -647,14 +648,15 @@ async def set_typing(self, room_id: str, is_typing: bool = True, timeout: int =
}
if is_typing:
content["timeout"] = timeout
resp = await self.client.request("PUT", f"/rooms/{room_id}/typing/{self.mxid}", content)
resp = await self.client.request("PUT",
f"/rooms/{quote(room_id)}/typing/{self.mxid}", content)
self.state_store.set_typing(room_id, self.mxid, is_typing, timeout)
return resp

async def mark_read(self, room_id: str, event_id: str) -> dict:
await self.ensure_joined(room_id)
return await self.client.request("POST", f"/rooms/{room_id}/receipt/m.read/{event_id}",
content={})
return await self.client.request(
"POST", f"/rooms/{quote(room_id)}/receipt/m.read/{quote(event_id)}", content={})

def send_notice(self, room_id: str, text: str, html: Optional[str] = None,
relates_to: Optional[dict] = None, **kwargs) -> Awaitable[dict]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="mautrix-appservice",
version="0.3.7",
version="0.3.8",
url="https://github.com/tulir/mautrix-appservice-python",

author="Tulir Asokan",
Expand Down

0 comments on commit 21bb087

Please sign in to comment.