Compare commits

..

1 Commits

Author SHA1 Message Date
michael-corey
f4b4d0e928 adding exception counter 2026-04-22 10:09:41 -05:00

View File

@ -313,7 +313,9 @@ 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))
@ -334,14 +336,13 @@ def explore_directories(
file_count = len(files)
# --- Permission check on first file -----------------------------------
# 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.
# in "/") for the head_object test. The listing is already filtered
# to the requested extensions, so any non-marker key is a valid probe.
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) and matches_extensions(key, exts_lower):
if not (key.endswith("/") and size == 0):
test_key = key
break
@ -435,7 +436,7 @@ def print_results(results: Results, *, extensions: Set[str] | None = None) -> No
for d in results.available:
print(f" {d.prefix}")
print(
f" Matching files ({ext_label}): {d.accessible_count}/{d.total_count} accessible"
f" {ext_label} files: {d.accessible_count}/{d.total_count} accessible"
f" | Total Size: {format_size(d.accessible_size)}"
)
else: