@@ -18,7 +18,8 @@ package com.spectralogic.ds3cli
1818import com.google.common.collect.ImmutableList
1919import com.spectralogic.ds3cli.exceptions.CommandException
2020import com.spectralogic.ds3client.Ds3Client
21- import com.spectralogic.ds3client.commands.spectrads3.GetObjectsWithFullDetailsSpectraS3Request
21+ import com.spectralogic.ds3client.commands.spectrads3.GetObjectDetailsSpectraS3Request
22+ import com.spectralogic.ds3client.commands.spectrads3.GetObjectsDetailsSpectraS3Request
2223import com.spectralogic.ds3client.models.Contents
2324import com.spectralogic.ds3client.networking.FailedRequestException
2425import kotlinx.coroutines.*
@@ -38,17 +39,28 @@ object PipeUtils {
3839 pipedFileNames.map { objName ->
3940 async(Dispatchers .IO ) {
4041 try {
41- val result = client.getObjectsWithFullDetailsSpectraS3(
42- GetObjectsWithFullDetailsSpectraS3Request ().withBucketId(bucketName).withName(objName));
43-
44- if (result.detailedS3ObjectListResult.detailedS3Objects == null || result.detailedS3ObjectListResult.detailedS3Objects.size == 0 ) {
45- GetObjectResponse .NotFound (objName)
46- } else if (result.detailedS3ObjectListResult.detailedS3Objects.size > 1 ) {
47- GetObjectResponse .Error (IOException (" There are multiple versions of object with name: $objName " ))
42+ if (objName.endsWith(" .json" , ignoreCase = true )) {
43+ // If this is an object that ends in .json, then perform the more expensive call that
44+ // bypasses the json formatting feature of response payloads in BP
45+ val result = client.getObjectsDetailsSpectraS3(
46+ GetObjectsDetailsSpectraS3Request ().withBucketId(bucketName).withName(objName).withLatest(true ))
47+
48+ if (result.s3ObjectListResult.s3Objects == null || result.s3ObjectListResult.s3Objects.size == 0 ) {
49+ GetObjectResponse .NotFound (objName)
50+ } else if (result.s3ObjectListResult.s3Objects.size > 1 ) {
51+ GetObjectResponse .Error (IOException (" There are multiple versions of object with name: $objName " ))
52+ } else {
53+ GetObjectResponse .Success (Contents ().apply {
54+ key = result.s3ObjectListResult.s3Objects[0 ].name
55+ lastModified = result.s3ObjectListResult.s3Objects[0 ].creationDate
56+ })
57+ }
4858 } else {
59+ val result = client.getObjectDetailsSpectraS3(GetObjectDetailsSpectraS3Request (objName, bucketName)).s3ObjectResult
60+
4961 GetObjectResponse .Success (Contents ().apply {
50- key = result.detailedS3ObjectListResult.detailedS3Objects[ 0 ]. name
51- lastModified = result.detailedS3ObjectListResult.detailedS3Objects[ 0 ]. creationDate
62+ key = result.name
63+ lastModified = result.creationDate
5264 })
5365 }
5466 } catch (f: FailedRequestException ) {
0 commit comments