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