Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/minio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ class Minio {

return StatObjectResult(
etag: etag,
size: int.parse(resp.headers['content-length']!),
size: int.tryParse(resp.headers['content-length'] ?? ''),
Comment on lines 1134 to +1136
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing tests for statObject() that assert size is non-null, but this change introduces new behavior when content-length is missing (returning null instead of crashing). Please add coverage for the missing-header case; if it’s hard to reproduce against the live MinIO endpoint, consider extracting the header-parsing into a small pure helper that can be unit tested with synthetic header maps.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int.tryParse(resp.headers['content-length'] ?? '') changes behavior for malformed content-length values (it will silently return null instead of throwing). Consider handling the two cases separately: return null only when the header is missing, but if it is present and not parseable, surface a clear error so callers aren’t debugging an unexpected null size.

Copilot uses AI. Check for mistakes.
metaData: extractMetadata(resp.headers),
lastModified: parseRfc7231Time(resp.headers['last-modified']!),
acl: retrieveAcls ? await getObjectACL(bucket, object) : null,
Comment on lines 1138 to 1139
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StatObjectResult.lastModified is nullable, but statObject() force-unwraps resp.headers['last-modified']!, which will still crash if that header is absent. To align with the model’s nullability (and avoid a similar class of runtime errors), parse it conditionally and pass null when the header is missing.

Copilot uses AI. Check for mistakes.
Expand Down
Loading