Skip to content

Commit d393252

Browse files
authored
Add port to storage upload url (#3324)
1 parent cd9d226 commit d393252

File tree

1 file changed

+3
-1
lines changed
  • google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1

1 file changed

+3
-1
lines changed

google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,10 @@ public String open(StorageObject object, Map<Option, ?> options) {
717717
GenericUrl url = req.buildHttpRequest().getUrl();
718718
String scheme = url.getScheme();
719719
String host = url.getHost();
720+
int port = url.getPort();
721+
port = port < 0 ? port : url.toURL().getDefaultPort();
720722
String path = "/upload" + url.getRawPath();
721-
url = new GenericUrl(scheme + "://" + host + path);
723+
url = new GenericUrl(scheme + "://" + host + ":" + port + path);
722724
url.set("uploadType", "resumable");
723725
url.set("name", object.getName());
724726
for (Option option : options.keySet()) {

0 commit comments

Comments
 (0)