signed url with query string creates invalid result
```

-
Hi Joel!
This seems to be coming from the encoding of the remote function URL, which should be URL-safe Base64 encoded rather than just baes64.
Please see the working URLs here -
We'll be updating the SDK shortly to use URL-safe encoding for remote functions.
0 -
Hey Brian, thanks for the explanation! I'm not quite understanding yet.
Is there anything I can do on my end to make this work, or is waiting for the SDK update required?
0 -
Hey Joel,
We have opened an internal ticket for our SDK team to fix this issue.
Note that the difference between the URL-safe base64 encoding and the regular base64 encoding comes up to three characters only - '+', '/', and '='.
Until our SDK team fixes the issue, you can solve this locally in one of the following two ways -
- Continue using the same flow as before, and take the base64 encoded string of the pre-function and adjust it in this way -
Replace '+' characters with '-'.
Replace '/' characters with '_'.
Remove trailing '=' characters.
Then reuse the "cloudinary.url()" method in the following way -cloudinary.url("v{version}/{public_id}", {
sign_url:true,
raw_transformation:"fn_pre:remote:{base64 string after the above adjustments}"
})For example -
cloudinary.url("v1586034934/og_images/pixel_zeddhz.png", {
sign_url:true,
raw_transformation:"fn_pre:remote:aHR0cHM6Ly9jb21wZXRlbnQtZ29vZGFsbC1kNzFkMGQubmV0bGlmeS5jb20vLm5ldGxpZnkvZnVuY3Rpb25zL2dlbi1vcGVuZ3JhcGgtaW1hZ2U_dGl0bGU9aGVsbG8lMjBmcmllbmRz"
}) - Fix the local copy of the Cloudinary SDK in the following way -
Make use of this library - https://www.npmjs.com/package/urlsafe-base64,
and change this line and this line, into -
return [customFunction.function_type, URLSafeBase64.encode(base64EncodeURL(customFunction.source))].join(":");
Let me know if you have any questions!
In any way, we'll update this thread about any progress made regarding the SDK fix.0 - Continue using the same flow as before, and take the base64 encoded string of the pre-function and adjust it in this way -
Post is closed for comments.
Comments
3 comments