File tree 1 file changed +15
-2
lines changed
src/main/java/net/snowflake/client/jdbc/cloud/storage
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1314,7 +1314,7 @@ private void setupGCSClient(
1314
1314
if (accessToken != null ) {
1315
1315
// We are authenticated with an oauth access token.
1316
1316
StorageOptions .Builder builder = StorageOptions .newBuilder ();
1317
- stage . gcsCustomEndpoint (). ifPresent ( builder :: setHost );
1317
+ overrideHost ( stage , builder );
1318
1318
1319
1319
if (areDisabledGcsDefaultCredentials (session )) {
1320
1320
logger .debug (
@@ -1335,7 +1335,7 @@ private void setupGCSClient(
1335
1335
// Use anonymous authentication.
1336
1336
HttpStorageOptions .Builder builder =
1337
1337
HttpStorageOptions .newBuilder ().setCredentials (NoCredentials .getInstance ());
1338
- stage . gcsCustomEndpoint (). ifPresent ( builder :: setHost );
1338
+ overrideHost ( stage , builder );
1339
1339
this .gcsClient = builder .build ().getService ();
1340
1340
}
1341
1341
@@ -1357,6 +1357,19 @@ private void setupGCSClient(
1357
1357
}
1358
1358
}
1359
1359
1360
+ private static void overrideHost (StageInfo stage , StorageOptions .Builder builder ) {
1361
+ stage
1362
+ .gcsCustomEndpoint ()
1363
+ .ifPresent (
1364
+ host -> {
1365
+ if (host .startsWith ("https://" )) {
1366
+ builder .setHost (host );
1367
+ } else {
1368
+ builder .setHost ("https://" + host );
1369
+ }
1370
+ });
1371
+ }
1372
+
1360
1373
private static boolean areDisabledGcsDefaultCredentials (SFSession session ) {
1361
1374
return session != null && session .getDisableGcsDefaultCredentials ()
1362
1375
|| convertSystemPropertyToBooleanValue (
You can’t perform that action at this time.
0 commit comments