diff --git a/reflex/components/core/upload.py b/reflex/components/core/upload.py index 6c86d3c44..682fd45a9 100644 --- a/reflex/components/core/upload.py +++ b/reflex/components/core/upload.py @@ -147,7 +147,7 @@ uploaded_files_url_prefix = Var( ).to(str) -def get_upload_url(file_path: str) -> Var[str]: +def get_upload_url(file_path: str | Var[str]) -> Var[str]: """Get the URL of an uploaded file. Args: @@ -158,7 +158,7 @@ def get_upload_url(file_path: str) -> Var[str]: """ Upload.is_used = True - return uploaded_files_url_prefix + "/" + file_path + return Var.create(f"{uploaded_files_url_prefix}/{file_path}") def _on_drop_spec(files: Var) -> Tuple[Var[Any]]: diff --git a/reflex/components/core/upload.pyi b/reflex/components/core/upload.pyi index d1ddceb4d..7c918bee8 100644 --- a/reflex/components/core/upload.pyi +++ b/reflex/components/core/upload.pyi @@ -35,7 +35,7 @@ uploaded_files_url_prefix = Var( ), ).to(str) -def get_upload_url(file_path: str) -> Var[str]: ... +def get_upload_url(file_path: str | Var[str]) -> Var[str]: ... class UploadFilesProvider(Component): @overload diff --git a/reflex/py.typed b/reflex/py.typed new file mode 100644 index 000000000..e69de29bb