@@ -423,7 +423,12 @@ def _download_url(uri: raw_nodes.URI, output: typing.Optional[os.PathLike] = Non
423423 local_path = pathlib .Path (output )
424424 elif BIOIMAGEIO_USE_CACHE :
425425 # todo: proper caching
426- local_path = BIOIMAGEIO_CACHE_PATH / uri .scheme / uri .authority / uri .path .strip ("/" ) / uri .query
426+ if uri .authority == "zenodo.org" and uri .path .startswith ("/api/records/" ) and uri .path .endswith ("/content" ):
427+ p = uri .path [: - len ("/content" )].strip ("/" )
428+ else :
429+ p = uri .path .strip ("/" )
430+
431+ local_path = BIOIMAGEIO_CACHE_PATH / uri .scheme / uri .authority / p / uri .query
427432 else :
428433 tmp_dir = TemporaryDirectory ()
429434 no_cache_tmp_list .append (tmp_dir ) # keep temporary file until process ends
@@ -462,9 +467,9 @@ def _download_url(uri: raw_nodes.URI, output: typing.Optional[os.PathLike] = Non
462467 total_size = int (r .headers .get ("content-length" , 0 ))
463468 block_size = 1024 # 1 Kibibyte
464469 if pbar :
465- t = pbar (total = total_size , unit = "iB" , unit_scale = True , desc = uri . path . split ( "/" )[ - 1 ] )
470+ t = pbar (total = total_size , unit = "iB" , unit_scale = True , desc = local_path . name )
466471 else :
467- t = tqdm (total = total_size , unit = "iB" , unit_scale = True , desc = uri . path . split ( "/" )[ - 1 ] )
472+ t = tqdm (total = total_size , unit = "iB" , unit_scale = True , desc = local_path . name )
468473 tmp_path = local_path .with_suffix (f"{ local_path .suffix } .part" )
469474 with tmp_path .open ("wb" ) as f :
470475 for data in r .iter_content (block_size ):
0 commit comments