diff --git a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java index 19c9324518d7..e59b24d67d45 100644 --- a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java +++ b/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java @@ -718,7 +718,7 @@ public String open(StorageObject object, Map options) { String scheme = url.getScheme(); String host = url.getHost(); int port = url.getPort(); - port = port < 0 ? port : url.toURL().getDefaultPort(); + port = port > 0 ? port : url.toURL().getDefaultPort(); String path = "/upload" + url.getRawPath(); url = new GenericUrl(scheme + "://" + host + ":" + port + path); url.set("uploadType", "resumable");