Compare commits
2 Commits
f4b4d0e928
...
f3bd5f02aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3bd5f02aa | ||
|
|
011d8418a6 |
@ -313,9 +313,7 @@ def explore_directories(
|
||||
|
||||
# --- Recursive listing ------------------------------------------------
|
||||
try:
|
||||
files, total_size = list_objects(
|
||||
s3, S3_BUCKET, prefix, extensions=extensions,
|
||||
)
|
||||
files, total_size = list_objects(s3, S3_BUCKET, prefix, extensions=extensions)
|
||||
except botocore.exceptions.ClientError as exc:
|
||||
code = exc.response.get("Error", {}).get("Code", "Unknown")
|
||||
message = exc.response.get("Error", {}).get("Message", str(exc))
|
||||
@ -336,13 +334,14 @@ def explore_directories(
|
||||
file_count = len(files)
|
||||
|
||||
# --- Permission check on first file -----------------------------------
|
||||
# in "/") for the head_object test. The listing is already filtered
|
||||
# to the requested extensions, so any non-marker key is a valid probe.
|
||||
# Prefer a real object over a zero-byte directory marker (key ending
|
||||
# in "/") for the head_object test. The selected key must also match
|
||||
# the extension filter.
|
||||
first_key, _ = files[0]
|
||||
test_key = first_key
|
||||
if first_key.endswith("/") and total_size > 0:
|
||||
for key, size in files:
|
||||
if not (key.endswith("/") and size == 0):
|
||||
if not (key.endswith("/") and size == 0) and matches_extensions(key, exts_lower):
|
||||
test_key = key
|
||||
break
|
||||
|
||||
@ -436,7 +435,7 @@ def print_results(results: Results, *, extensions: Set[str] | None = None) -> No
|
||||
for d in results.available:
|
||||
print(f" {d.prefix}")
|
||||
print(
|
||||
f" {ext_label} files: {d.accessible_count}/{d.total_count} accessible"
|
||||
f" Matching files ({ext_label}): {d.accessible_count}/{d.total_count} accessible"
|
||||
f" | Total Size: {format_size(d.accessible_size)}"
|
||||
)
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user