1

I'm creating resumable upload signed urls in google cloud and passing the link to an external API for performing some process. On examining the callbacks from the API, I can see the url actually being split into different parameters because of the & present in the google signed url.

callback": "https://storage.googleapis.com/bucket/file-name?x-goog-"x-goog-date": "20220303T233221Z",
"x-goog-expires": "3600",
"callback_method": "put",
"x-goog-algorithm": "GOOG4-RSA-SHA256",
"x-goog-credential": "****",
"x-goog-signedheaders": "host"

The signed url looks like

https://storage.googleapis.com/bucket/file-name?x-goog-signature=4398348934893498fjksdfjksdjk&x-goog-algorithm=GOOG4-RSA-SHA256&x-goog-credential=bucket40project.iam.gserviceaccount.com%2F2003%2Fus-west1%2Fstorage%2Fgoog4_request&x-goog-date=202201Z&x-goog-expires=3600&x-goog-signedheaders=host

and the curl request to the API looks like

curl --request POST
-url 'website.com?callback=<the above url>"
--header 
--data

Any input would be really appreciated. I tried including an \ before the & or enclosing it within quotes, but nothing seems to work.

Tony Stark
  • 511
  • 2
  • 15

1 Answers1

2

Based on this answer.

You need to url-encode the previous url

curl --request POST \
    --data-urlencode "callback=<the above url>" \
    website.com
loki
  • 2,271
  • 5
  • 32
  • 46