🐛 Maybe fixed unicode error in export-function
This commit is contained in:
@@ -7,8 +7,8 @@ from datetime import datetime
|
|||||||
|
|
||||||
import ormar.exceptions
|
import ormar.exceptions
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
from fastapi import APIRouter, Depends, Response, File, UploadFile, HTTPException
|
from fastapi import APIRouter, Depends, File, UploadFile, HTTPException
|
||||||
|
from fastapi.responses import StreamingResponse
|
||||||
from classquiz.auth import get_current_user
|
from classquiz.auth import get_current_user
|
||||||
from classquiz.config import storage, settings
|
from classquiz.config import storage, settings
|
||||||
from classquiz.db.models import Quiz, User
|
from classquiz.db.models import Quiz, User
|
||||||
@@ -52,8 +52,11 @@ async def export_quiz(quiz_id: uuid.UUID, user: User = Depends(get_current_user)
|
|||||||
image_data = await resp.read()
|
image_data = await resp.read()
|
||||||
bin_data = bin_data + image_data
|
bin_data = bin_data + image_data
|
||||||
|
|
||||||
return Response(
|
def stream_response():
|
||||||
content=bin_data,
|
yield bin_data
|
||||||
|
|
||||||
|
return StreamingResponse(
|
||||||
|
stream_response(),
|
||||||
media_type="application/octet-stream",
|
media_type="application/octet-stream",
|
||||||
headers={
|
headers={
|
||||||
"Content-Disposition": f"attachment;filename={quiz.title}.cqa"
|
"Content-Disposition": f"attachment;filename={quiz.title}.cqa"
|
||||||
|
|||||||
@@ -95,6 +95,7 @@
|
|||||||
if you really need it, since you need the consent of <b>EVERY</b> player to load
|
if you really need it, since you need the consent of <b>EVERY</b> player to load
|
||||||
the captcha.
|
the captcha.
|
||||||
</p>
|
</p>
|
||||||
|
<!-- Todo: Add translation -->
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user