Skip to content

Commit

Permalink
fix: stat.etag could contains / (#1309)
Browse files Browse the repository at this point in the history
if `stat.etag` contains `/`, will cause exception that `fget_object` try
to write to a non-exists directory
  • Loading branch information
Laisky authored Sep 24, 2023
1 parent 59ca9bc commit 2ed4e89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
ThreadPool, check_bucket_name, check_non_empty_string,
check_sse, check_ssec, genheaders, get_part_info,
headers_to_strings, is_valid_policy_type, makedirs,
md5sum_hash, read_part_data, sha256_hash)
md5sum_hash, read_part_data, sha256_hash, queryencode)
from .legalhold import LegalHold
from .lifecycleconfig import LifecycleConfig
from .notificationconfig import NotificationConfig
Expand Down Expand Up @@ -1043,7 +1043,9 @@ def fget_object(self, bucket_name, object_name, file_path,
)

# Write to a temporary file "file_path.part.minio" before saving.
tmp_file_path = tmp_file_path or f"{file_path}.{stat.etag}.part.minio"
tmp_file_path = (
tmp_file_path or f"{file_path}.{queryencode(stat.etag)}.part.minio"
)

response = None
try:
Expand Down

0 comments on commit 2ed4e89

Please sign in to comment.