File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -79,17 +79,18 @@ def fetch_scripts(destination: str | Path = ".") -> Path:
7979 # Extract only medcat-scripts/ from the archive
8080 with zipfile .ZipFile (zip_path ) as zf :
8181 for m in zf .namelist ():
82- if f"/{ SCRIPTS_PATH } " in m :
83- # skip repo-hash prefix
84- target = dest / Path (* Path (m ).parts [1 :])
85- if m .endswith ("/" ):
86- target .mkdir (parents = True , exist_ok = True )
87- else :
88- with open (target , "wb" ) as f :
89- f .write (zf .read (m ))
90-
91- logger .info ("Scripts extracted to: %s" , dest / SCRIPTS_PATH )
92- return dest / SCRIPTS_PATH
82+ if f"/{ SCRIPTS_PATH } " not in m :
83+ continue
84+ # skip repo-hash prefix
85+ target = dest / Path (* Path (m ).parts [2 :])
86+ if m .endswith ("/" ):
87+ target .mkdir (parents = True , exist_ok = True )
88+ else :
89+ with open (target , "wb" ) as f :
90+ f .write (zf .read (m ))
91+
92+ logger .info ("Scripts extracted to: %s" , dest )
93+ return dest
9394
9495
9596def main (destination : str = "." ,
You can’t perform that action at this time.
0 commit comments