forked from mtusi2026/mtusi2026lab4
feat: добавить reconciler PostgreSQL и S3
This commit is contained in:
@@ -12,6 +12,7 @@ from uuid import UUID, uuid4
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
|
||||
from ..domain.errors import (
|
||||
Conflict,
|
||||
Invalid,
|
||||
NotFound,
|
||||
PayloadTooLarge,
|
||||
@@ -137,6 +138,8 @@ class AttachmentService:
|
||||
|
||||
async def content(self, actor: User, attachment_id: UUID) -> tuple[Attachment, ObjectStream]:
|
||||
attachment = await self.get(actor, attachment_id)
|
||||
if attachment.status != 'ready':
|
||||
raise Conflict('оригинал вложения недоступен')
|
||||
try:
|
||||
stream = await self._storage.get(attachment.object_key)
|
||||
except FileNotFoundError as error:
|
||||
|
||||
Reference in New Issue
Block a user