forked from mtusi2026/mtusi2026lab5
formatted project by python-black
This commit is contained in:
@@ -276,12 +276,20 @@ async def download_attachment(
|
||||
key = record.object_key
|
||||
info = DownloadInfo(result.filename, result.content_type, result.size_bytes)
|
||||
else:
|
||||
selected = next((item for item in result.variants if item.name == variant), None)
|
||||
keys = {"thumbnail": record.thumbnail_key, "crop": record.crop_key, "optimized": record.optimized_key}
|
||||
selected = next(
|
||||
(item for item in result.variants if item.name == variant), None
|
||||
)
|
||||
keys = {
|
||||
"thumbnail": record.thumbnail_key,
|
||||
"crop": record.crop_key,
|
||||
"optimized": record.optimized_key,
|
||||
}
|
||||
key = keys.get(variant)
|
||||
if selected is None or key is None:
|
||||
raise not_found()
|
||||
info = DownloadInfo(VARIANT_FILENAMES[variant], selected.content_type, selected.size_bytes)
|
||||
info = DownloadInfo(
|
||||
VARIANT_FILENAMES[variant], selected.content_type, selected.size_bytes
|
||||
)
|
||||
await session.rollback()
|
||||
stored = await storage.stat_object(key)
|
||||
if stored.size_bytes != info.size_bytes or stored.content_type != info.content_type:
|
||||
|
||||
Reference in New Issue
Block a user