-
Notifications
You must be signed in to change notification settings - Fork 151
fix: handle missing content-length header in statObject (#108) #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1133,7 +1133,7 @@ class Minio { | |
|
|
||
| return StatObjectResult( | ||
| etag: etag, | ||
| size: int.parse(resp.headers['content-length']!), | ||
| size: int.tryParse(resp.headers['content-length'] ?? ''), | ||
|
||
| metaData: extractMetadata(resp.headers), | ||
| lastModified: parseRfc7231Time(resp.headers['last-modified']!), | ||
| acl: retrieveAcls ? await getObjectACL(bucket, object) : null, | ||
|
Comment on lines
1138
to
1139
|
||
|
|
||
There was a problem hiding this comment.
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 assertsizeis non-null, but this change introduces new behavior whencontent-lengthis missing (returningnullinstead 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.