From 79b46a0ef0c8bd45b95ec4887789f9013a7fbcbc Mon Sep 17 00:00:00 2001 From: qin shulei Date: Wed, 28 Jun 2023 19:52:47 +0800 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/lfs/server/s3/S3Repository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java index 3c98d7b9e..5ebce5d8c 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java @@ -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;