@@ -117,10 +117,16 @@ UpdateResponse updateResumableUpload(String uploadId, HttpHeaderParser.ContentRa
117117 if (contentRange .hasRange () == false ) {
118118 // Content-Range: */... is a status check https://cloud.google.com/storage/docs/performing-resumable-uploads#status-check
119119 if (existing .completed ) {
120- updateResponse .set (new UpdateResponse (RestStatus .OK .getStatus (), calculateRangeHeader (blobs .get (existing .path ))));
120+ updateResponse .set (
121+ new UpdateResponse (
122+ RestStatus .OK .getStatus (),
123+ calculateRangeHeader (blobs .get (existing .path )),
124+ existing .contents .length ()
125+ )
126+ );
121127 } else {
122128 final HttpHeaderParser .Range range = calculateRangeHeader (existing );
123- updateResponse .set (new UpdateResponse (RESUME_INCOMPLETE , range ));
129+ updateResponse .set (new UpdateResponse (RESUME_INCOMPLETE , range , existing . contents . length () ));
124130 }
125131 return existing ;
126132 } else {
@@ -146,11 +152,11 @@ UpdateResponse updateResumableUpload(String uploadId, HttpHeaderParser.ContentRa
146152 // We just received the last chunk, update the blob and remove the resumable upload from the map
147153 if (contentRange .hasSize () && updatedContent .length () == contentRange .size ()) {
148154 updateBlob (existing .path (), existing .ifGenerationMatch , updatedContent );
149- updateResponse .set (new UpdateResponse (RestStatus .OK .getStatus (), null ));
155+ updateResponse .set (new UpdateResponse (RestStatus .OK .getStatus (), null , updatedContent . length () ));
150156 return existing .update (BytesArray .EMPTY , true );
151157 }
152158 final ResumableUpload updated = existing .update (updatedContent , false );
153- updateResponse .set (new UpdateResponse (RESUME_INCOMPLETE , calculateRangeHeader (updated )));
159+ updateResponse .set (new UpdateResponse (RESUME_INCOMPLETE , calculateRangeHeader (updated ), updated . contents . length () ));
154160 return updated ;
155161 }
156162 });
@@ -166,7 +172,7 @@ private static HttpHeaderParser.Range calculateRangeHeader(BlobVersion blob) {
166172 return blob .contents .length () > 0 ? new HttpHeaderParser .Range (0 , blob .contents .length () - 1 ) : null ;
167173 }
168174
169- record UpdateResponse (int statusCode , HttpHeaderParser .Range rangeHeader ) {}
175+ record UpdateResponse (int statusCode , HttpHeaderParser .Range rangeHeader , long storedContentLength ) {}
170176
171177 void deleteBlob (String path ) {
172178 blobs .remove (path );
0 commit comments