瀏覽代碼

Merge branch 'main' into download_local_file

Falko Schindler 1 年之前
父節點
當前提交
bc6571c5a2
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 3 3
      nicegui/app.py
  2. 1 1
      nicegui/elements/mixins/value_element.py

+ 3 - 3
nicegui/app.py

@@ -102,7 +102,7 @@ class App(FastAPI):
             url_path = f'/_nicegui/auto/static/{helpers.hash_file_path(file)}/{file.name}'
 
         @self.get(url_path)
-        async def read_item() -> FileResponse:
+        def read_item() -> FileResponse:
             return FileResponse(file, headers={'Cache-Control': 'public, max-age=3600'})
 
         return url_path
@@ -122,7 +122,7 @@ class App(FastAPI):
         :param local_directory: local folder with files to serve as media content
         """
         @self.get(url_path + '/{filename:path}')
-        async def read_item(request: Request, filename: str) -> StreamingResponse:
+        def read_item(request: Request, filename: str) -> StreamingResponse:
             filepath = Path(local_directory) / filename
             if not filepath.is_file():
                 return {'detail': 'Not Found'}, 404
@@ -148,7 +148,7 @@ class App(FastAPI):
             url_path = f'/_nicegui/auto/media/{helpers.hash_file_path(file)}/{file.name}'
 
         @self.get(url_path)
-        async def read_item(request: Request) -> StreamingResponse:
+        def read_item(request: Request) -> StreamingResponse:
             return helpers.get_streaming_response(file, request)
 
         return url_path

+ 1 - 1
nicegui/elements/mixins/value_element.py

@@ -1,4 +1,4 @@
-from typing import Any, Callable, List, Optional
+from typing import Any, Callable, Optional
 
 from typing_extensions import Self