@@ -312,6 +312,7 @@ def file_download(file_path: str):
312312 if file_path .startswith (minio_share_host ):
313313 # download file from minio sdk
314314 bucket_name , object_name = url_obj .path .replace (minio_share_host , "" , 1 ).lstrip ("/" ).split ('/' , 1 )
315+ object_name = unquote (object_name )
315316 file_content = minio_client .get_object_sync (bucket_name , object_name )
316317 else :
317318 # download file from http url
@@ -343,6 +344,7 @@ def file_download(file_path: str):
343344 if len (path_parts ) == 2 :
344345 bucket_name , object_name = path_parts
345346 # 调用同步的 minio 方法下载
347+ object_name = unquote (object_name )
346348 file_content = minio_client .get_object_sync (bucket_name , object_name )
347349
348350 filename = unquote (object_name .split ('/' )[- 1 ])
@@ -384,6 +386,7 @@ async def async_file_download(file_path: str):
384386 if file_path .startswith (minio_share_host ):
385387 # download file from minio sdk
386388 bucket_name , object_name = url_obj .path .replace (minio_share_host , "" , 1 ).lstrip ("/" ).split ('/' , 1 )
389+ object_name = unquote (object_name )
387390 file_content = await minio_client .get_object (bucket_name , object_name )
388391 else :
389392 r = await http_client .get (url = file_path , data_type = "binary" )
@@ -408,6 +411,7 @@ async def async_file_download(file_path: str):
408411
409412 if len (path_parts ) == 2 :
410413 bucket_name , object_name = path_parts
414+ object_name = unquote (object_name )
411415 # 直接使用 minio client 下载,无需 http 请求
412416 file_content = await minio_client .get_object (bucket_name , object_name )
413417
@@ -420,6 +424,7 @@ async def async_file_download(file_path: str):
420424
421425 raise ValueError ('File path %s is not a valid file or url' % file_path )
422426
427+
423428def _is_valid_url (url : str ):
424429 """Check if the url is valid."""
425430 parsed = urlparse (url )
0 commit comments