File tree Expand file tree Collapse file tree
api/src/main/java/io/minio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -890,7 +890,7 @@ public String getPresignedObjectUrl(GetPresignedObjectUrlArgs args) throws Minio
890890 }
891891
892892 Http .QueryParameters queryParams = new Http .QueryParameters ();
893- if (args .versionId () = = null ) queryParams .put ("versionId" , args .versionId ());
893+ if (args .versionId () ! = null ) queryParams .put ("versionId" , args .versionId ());
894894
895895 Credentials credentials = provider == null ? null : provider .fetch ();
896896 if (credentials != null && credentials .sessionToken () != null ) {
Original file line number Diff line number Diff line change 126126import java .util .concurrent .TimeUnit ;
127127import java .util .stream .Collectors ;
128128import okhttp3 .Headers ;
129+ import okhttp3 .HttpUrl ;
129130import okhttp3 .MultipartBody ;
130131import okhttp3 .Request ;
131132import okhttp3 .RequestBody ;
@@ -1270,6 +1271,23 @@ public void testGetPresignedObjectUrlForGet() throws Exception {
12701271 .build (),
12711272 expectedChecksum );
12721273
1274+ testTags = "[GET, versionId]" ;
1275+ String versionId = "dummy-version" ;
1276+ String urlString =
1277+ client .getPresignedObjectUrl (
1278+ GetPresignedObjectUrlArgs .builder ()
1279+ .method (Http .Method .GET )
1280+ .bucket (bucketName )
1281+ .object (objectName )
1282+ .versionId (versionId )
1283+ .build ());
1284+ HttpUrl url = HttpUrl .parse (urlString );
1285+ Assertions .assertNotNull (url , "generated url is not valid" );
1286+ Assertions .assertEquals (
1287+ versionId ,
1288+ url .queryParameter ("versionId" ),
1289+ "versionId query param does not match the expected value" );
1290+
12731291 testTags = "[GET, expiry, query params]" ;
12741292 Map <String , String > queryParams = new HashMap <>();
12751293 queryParams .put ("response-content-type" , "application/json" );
You can’t perform that action at this time.
0 commit comments