Skip to content

Commit 6848915

Browse files
authored
Update rx.get_upload_url signature to accept Var[str] (#4826)
* Update rx.get_upload_url signature to accept Var[str] * Add py.typed Fix #4806
1 parent 10bae95 commit 6848915

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

reflex/components/core/upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def get_upload_dir() -> Path:
147147
).to(str)
148148

149149

150-
def get_upload_url(file_path: str) -> Var[str]:
150+
def get_upload_url(file_path: str | Var[str]) -> Var[str]:
151151
"""Get the URL of an uploaded file.
152152
153153
Args:
@@ -158,7 +158,7 @@ def get_upload_url(file_path: str) -> Var[str]:
158158
"""
159159
Upload.is_used = True
160160

161-
return uploaded_files_url_prefix + "/" + file_path
161+
return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
162162

163163

164164
def _on_drop_spec(files: Var) -> Tuple[Var[Any]]:

reflex/components/core/upload.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ uploaded_files_url_prefix = Var(
3535
),
3636
).to(str)
3737

38-
def get_upload_url(file_path: str) -> Var[str]: ...
38+
def get_upload_url(file_path: str | Var[str]) -> Var[str]: ...
3939

4040
class UploadFilesProvider(Component):
4141
@overload

reflex/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)