MCPcopy Create free account
hub / github.com/AstrBotDevs/AstrBot / astrbot_web_upload_extension

Function astrbot_web_upload_extension

tests/test_fastapi_v1_dashboard.py:2597–2609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2595 from astrbot.api.web import request as plugin_request
2596
2597 async def astrbot_web_upload_extension():
2598 form = await plugin_request.form()
2599 files = await plugin_request.files()
2600 upload: PluginUploadFile | None = files.get("file")
2601 assert isinstance(upload, PluginUploadFile)
2602 return json_response(
2603 {
2604 "tags": form.getlist("tag"),
2605 "filename": upload.filename,
2606 "content_type": upload.content_type,
2607 "content": (await upload.read()).decode("utf-8"),
2608 }
2609 )
2610
2611 fake_core_lifecycle.star_context.registered_web_apis = [
2612 ("/upload", astrbot_web_upload_extension, ["POST"], "upload")

Callers

nothing calls this directly

Calls 7

json_responseFunction · 0.90
decodeMethod · 0.80
formMethod · 0.45
filesMethod · 0.45
getMethod · 0.45
getlistMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected