Fix S3Repository getSize to handle larger object sizes

Update `getSize` method in `S3Repository` to handle larger object sizes.
The method previously used `Integer.parseInt`
to parse the `Content-Length` header of an HTTP response,

which limited the maximum object size to 2 GB.

Replaces `Integer.parseInt` with `Long.parseLong`,
allowing the method to handle object sizes larger than 2 GB.

- Use minio as local S3 service for gerrit lfs plugin
- The minio seems will return the Content-length

Change-Id: Ia3a5fd1a335643786714aff3fcc7d10a6b152058
Signed-off-by: qin shulei <qinsl0106@thundersoft.com>
This commit is contained in:
qin shulei 2023-06-28 19:52:47 +08:00
parent 91b23cc552
commit 79b46a0ef0
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ public long getSize(AnyLongObjectId oid) throws IOException {
String contentLengthHeader = conn
.getHeaderField(HDR_CONTENT_LENGTH);
if (contentLengthHeader != null) {
return Integer.parseInt(contentLengthHeader);
return Long.parseLong(contentLengthHeader);
}
}
return -1;