diff --git a/src/snek/view/channel.py b/src/snek/view/channel.py index 86ed7a0..9d36d8f 100644 --- a/src/snek/view/channel.py +++ b/src/snek/view/channel.py @@ -8,7 +8,7 @@ from snek.system.view import BaseView import aiofiles from aiohttp import web import pathlib - +import urllib.parse class ChannelAttachmentView(BaseView): async def get(self): @@ -116,10 +116,16 @@ class ChannelAttachmentView(BaseView): while chunk := await field.read_chunk(): await f.write(chunk) + attachment_records = [] + for attachment in attachments: + attachment_record = attachment.record + attachment_record['relative_url'] = urllib.parse.quote(attachment_record['relative_url']) + attachment_records.append(attachment_record) + return web.json_response( { "message": "Files uploaded successfully", - "files": [attachment.record for attachment in attachments], + "files": attachment_records, "channel_uid": channel_uid, } )