@@ -833,16 +833,18 @@ def __init__(self, *args, **kwargs):
833833 super ().__init__ (* args , directory = str (html_file_path .parent ), ** kwargs )
834834
835835 def do_GET (self ):
836- # If requesting root, serve our HTML file
837- if self .path == "/" or self .path == "" :
838- self .send_response (200 )
839- self .send_header ("Content-type" , "text/html" )
840- self .end_headers ()
841- with open (html_file_path , "rb" ) as f :
842- self .wfile .write (f .read ())
843- else :
844- # Serve other files normally (CSS, JS, images)
845- super ().do_GET ()
836+ # Route based on path
837+ match self .path :
838+ case "/" | "" :
839+ # Serve our HTML file
840+ self .send_response (200 )
841+ self .send_header ("Content-type" , "text/html" )
842+ self .end_headers ()
843+ with open (html_file_path , "rb" ) as f :
844+ self .wfile .write (f .read ())
845+ case _:
846+ # Serve other files normally (CSS, JS, images)
847+ super ().do_GET ()
846848
847849 def log_message (self , format , * args ):
848850 # Suppress server logs
@@ -1301,12 +1303,13 @@ async def capture_batch(
13011303
13021304 # Validate existing files
13031305 for file_path in existing_files :
1304- if Path (file_path ).exists ():
1305- results [str (file_path )] = str (file_path )
1306+ file_path_obj = Path (file_path )
1307+ if file_path_obj .exists ():
1308+ results [file_path ] = file_path
13061309 self .logger .debug (f"Using existing file: { file_path } " )
13071310 else :
13081311 failed_count += 1
1309- results [str ( file_path ) ] = f"Error: File not found"
1312+ results [file_path ] = f"Error: File not found"
13101313 self .logger .warning (f"File not found: { file_path } " )
13111314
13121315 # Capture URLs using BatchCapture for efficiency
@@ -1388,11 +1391,12 @@ async def capture_batch_async(
13881391
13891392 # Validate existing files
13901393 for file_path in existing_files :
1391- if Path (file_path ).exists ():
1392- results [str (file_path )] = str (file_path )
1394+ file_path_obj = Path (file_path )
1395+ if file_path_obj .exists ():
1396+ results [file_path ] = file_path
13931397 self .logger .debug (f"Using existing file: { file_path } " )
13941398 else :
1395- results [str ( file_path ) ] = f"Error: File not found"
1399+ results [file_path ] = f"Error: File not found"
13961400 self .logger .warning (f"File not found: { file_path } " )
13971401
13981402 # Capture sources concurrently
0 commit comments