mardi 19 juillet 2016

Cloudinary download_archive_url returns a url with spaces

I have been using the Cloudinary Uploader API method create_archive to gather a bunch of file names (public_ids) and create/upload an archive to my cloudinary account. Then I was able to parse through the response and get a succinct secure url to that archive which I could mail to the user. But then we decided we wanted to incorporate a 24 hour expiry timestamp on our archives. I found in the API documentation that you can use a parameter called expires_at if you are using the download API methods instead of the create API methods.

The difference is rather than calling Cloudinary::Uploader.create_archive(options = {}) I would have to call Cloudinary::Utils.download_archive_url(options = {}) which instead of returning a hash object would return a big chunky generated url listing all of the public_ids in the url.

I was able to confirm that the expires_at parameter was being set but when I get the url back from Cloudinary it has a bunch of spaces in it. I found a direct correlation between the length of the generated url and these disruptive spaces showing up in the url.

I tried gsub'ing out the spaces using /\s+/, "%20", and " ", none of which work.

Has anyone else experienced this anomaly? If so how did you overcome it?

Aucun commentaire:

Enregistrer un commentaire