From 08307c07f42a00794b777e5b0007418fa5624074 Mon Sep 17 00:00:00 2001 From: BenWhitehead Date: Thu, 10 Oct 2024 12:39:27 -0400 Subject: [PATCH] fix: fix createFrom resumable upload retry offset calculation Fixes #2770 --- .../src/main/java/com/google/cloud/storage/StorageImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java index fa16c9aed1..ee538bcde8 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java @@ -270,8 +270,7 @@ public Blob createFrom(BlobInfo blobInfo, Path path, int bufferSize, BlobWriteOp getOptions().asRetryDependencies(), retryAlgorithmManager.idempotent(), jsonResumableWrite); - HttpContentRange contentRange = - HttpContentRange.of(ByteRangeSpec.relativeLength(0L, size), size); + HttpContentRange contentRange = HttpContentRange.of(ByteRangeSpec.explicit(0L, size), size); ResumableOperationResult put = session.put(RewindableContent.of(path), contentRange); // all exception translation is taken care of down in the JsonResumableSession @@ -1724,8 +1723,7 @@ public BlobInfo internalCreateFrom(Path path, BlobInfo info, Opts put = session.put(RewindableContent.of(path), contentRange); // all exception translation is taken care of down in the JsonResumableSession