-1

I'm storing some images in firebase, firebase gives me an url to download the image like this one:

https://firebasestorage.googleapis.com/v0/b/afel-orders-mirror.appspot.com/o/stock_pictures%2F1000%2Falicate%20cortante%20electronica.jpg?alt=media&token=f2d54a3b-0526-4b9a-99ff-4c38c468757c

the permissions to download the images are full open

I want to upload the images through a rest api in another server from MercadoLibre (api.mercadolibre.com)

to upload the images I have to send the pictures like this

{"source":"https://firebasestorage.googleapis.com/v0/b/afel-orders-mirror.appspot.com/o/stock_pictures%2F1000%2Falicate%20cortante%20electronica.jpg?alt=media&token=f2d54a3b-0526-4b9a-99ff-4c38c468757c"}

via POST

The problem is that the server from mercadolibre encodes the url, and broke the url and the server tries to download the images from this url

https://firebasestorage.googleapis.com/v0/b/afel-orders-mirror.appspot.com/o/stock_pictures%252F1000%252Falicate%2520cortante%2520electronica.jpg%3Falt%3Dmedia%26token%3Df2d54a3b-0526-4b9a-99ff-4c38c468757c

notice the %25

this link gives the following error

{
  "error": {
    "code": 404,
    "message": "Not Found.  Could not get object"
  }
}

so in python i tried to decode the first url

https://firebasestorage.googleapis.com/v0/b/afel-orders-mirror.appspot.com/o/stock_pictures/1000/alicate cortante electronica.jpg?alt=media&token=f2d54a3b-0526-4b9a-99ff-4c38c468757c

(this link gives the following error)

{
  "error": {
    "code": 400,
    "message": "Invalid HTTP method/URL pair."
  }
}

with the idea that when the mercadolibre server encodes the url i get the original, but the problem is that only the "/" after "/o/" should be converted to %2F

I have no control over the url encoding (which is automatic in the mercadolibre server), what can i do to send a url that after is encoded i get the original url in a valid format??

thanks.

1 Answers1

0

As a workaround i shortered the url using the google api goo.gl this works for mercadolibre, facebook or any other api that requires an url to upload a picture.

greetings.