Skip to content

Commit 0a73459

Browse files
committed
Fix folder marker size in ListObjects and improve Makefile
- Directories now report size 0 instead of filesystem block size (4096) - Makefile clears test cache and greps for FAIL to catch errors
1 parent 0ad8937 commit 0a73459

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test-integration-up:
2121
docker compose -f compose.test.yaml up -d --build
2222
@echo "Waiting for container to be ready..."
2323
@sleep 2
24-
go test ./integration/... -v
24+
go clean -testcache && go test ./integration/... -v 2>&1 | tee /tmp/integration-test.log; \
25+
if grep -q "FAIL" /tmp/integration-test.log; then exit 1; fi
2526

2627
# Stop test container
2728
test-integration-down:

internal/storage/storage.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,15 @@ func (s *Storage) ListObjects(prefix string) ([]Object, error) {
309309
return nil
310310
}
311311

312+
// Directories report size 0 (S3 folder marker convention)
313+
size := info.Size()
314+
if info.IsDir() {
315+
size = 0
316+
}
317+
312318
objects = append(objects, Object{
313319
Key: key,
314-
Size: info.Size(),
320+
Size: size,
315321
LastModified: info.ModTime(),
316322
ContentType: guessContentType(key),
317323
ETag: generateETag(info),

0 commit comments

Comments
 (0)