Skip to content

Commit 63ba764

Browse files
authored
Update the build plugin api params (#615)
* Update the build plugin api params * update seek * fix lint
1 parent 1a77341 commit 63ba764

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

backend/app/admin/api/v1/sys/plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
from typing import Annotated, Any
44

5-
from fastapi import APIRouter, Depends, File, UploadFile
5+
from fastapi import APIRouter, Depends, File, Path, UploadFile
66
from fastapi.params import Query
77
from starlette.responses import StreamingResponse
88

@@ -84,16 +84,15 @@ async def update_plugin_status(plugin: Annotated[str, Query(description='插件
8484

8585

8686
@router.get(
87-
'/zip',
87+
'/zip/{plugin}',
8888
summary='打包插件',
8989
dependencies=[
9090
Depends(RequestPermission('sys:plugin:zip')),
9191
DependsRBAC,
9292
],
9393
)
94-
async def build_plugin(plugin: Annotated[str, Query(description='插件名称')]) -> StreamingResponse:
94+
async def build_plugin(plugin: Annotated[str, Path(description='插件名称')]) -> StreamingResponse:
9595
bio = await plugin_service.build(plugin=plugin)
96-
bio.seek(0)
9796
return StreamingResponse(
9897
bio,
9998
media_type='application/x-zip-compressed',

backend/app/admin/service/plugin_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ async def build(*, plugin: str) -> io.BytesIO:
184184
arcname = os.path.relpath(file_path, start=plugin_dir)
185185
zf.write(file_path, arcname)
186186

187+
bio.seek(0)
187188
return bio
188189

189190

0 commit comments

Comments
 (0)