66import multiprocessing
77import os
88import re
9+ import urllib .parse
910from collections import defaultdict
1011from collections .abc import Generator , Iterable
1112from dataclasses import dataclass
@@ -798,9 +799,9 @@ def join_traversalsafe(self, root: Path, joined: Path) -> Path:
798799
799800 return root
800801
801- def join_all_traversalsafe (self , root : Path , * paths : Path ) -> Path :
802+ def join_all_traversalsafe (self , root : Path , * paths : str ) -> Path :
802803 for path in paths :
803- root = self .join_traversalsafe (root , path )
804+ root = self .join_traversalsafe (root , Path ( path ) )
804805
805806 return root
806807
@@ -816,14 +817,13 @@ def run(self) -> Generator[Any, object, Any]:
816817 if not out_path : # if, e.g., the build fails and doesn't produce an output
817818 return util .SKIPPED
818819
819- project_name = Path (props .getProperty ("projectname" ))
820-
821- target = Path (props .getProperty ("branch" ))
822-
823- attr = Path (props .getProperty ("attr" ))
820+ owner = urllib .parse .quote_plus (self .project .owner )
821+ repo = urllib .parse .quote_plus (self .project .repo )
822+ target = urllib .parse .quote_plus (props .getProperty ("branch" ))
823+ attr = urllib .parse .quote_plus (props .getProperty ("attr" ))
824824
825825 try :
826- file = self .join_all_traversalsafe (self .path , project_name , target , attr )
826+ file = self .join_all_traversalsafe (self .path , owner , repo , target , attr )
827827 except ValueError as e :
828828 error_log : StreamLog = yield self .addLog ("path_error" )
829829 error_log .addStderr (f"Path traversal prevented ... skipping update: { e } " )
0 commit comments