File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -98,12 +98,10 @@ def set_initial_values(self):
9898
9999 def path_found (self , i , j ):
100100 if self .colored_graph [i ][j ] == "green" :
101- return rx ._x .toast .success (
102- f"Path found to [{ i } ,{ j } ]" , position = "top-center"
103- )
101+ return rx .toast .success (f"Path found to [{ i } ,{ j } ]" , position = "top-center" )
104102
105103 def path_not_found (self ):
106- return rx ._x . toast .error ("No path found" , position = "top-center" )
104+ return rx .toast .error ("No path found" , position = "top-center" )
107105
108106 def explore_neighbors (self , i , j , mode = None ):
109107 if self .colored_graph [i ][j ] != "red" :
Original file line number Diff line number Diff line change @@ -27,9 +27,13 @@ async def handle_upload(self, files: List[rx.UploadFile]):
2727 # Iterate through the uploaded files.
2828 for file in files :
2929 upload_data = await file .read ()
30- outfile = Path (rx .get_upload_dir ()) / file .name .lstrip ("/" )
31- outfile .parent .mkdir (parents = True , exist_ok = True )
32- outfile .write_bytes (upload_data )
30+ if file .name :
31+ outfile = Path (rx .get_upload_dir ()) / file .name .lstrip ("/" )
32+ outfile .parent .mkdir (parents = True , exist_ok = True )
33+ outfile .write_bytes (upload_data )
34+ else :
35+ # Unlikely to happens but make pyright happy to check for empty file names.
36+ yield rx .toast ("File name is empty. Please select a valid file." )
3337
3438 def on_upload_progress (self , prog : dict ):
3539 print ("Got progress" , prog )
You can’t perform that action at this time.
0 commit comments