degeist / book-cover-generator

A tool to create user-generated book covers and share on social media.
Other
2 stars 0 forks source link

Some text strings breaks the Cloudinary URL fetch #58

Closed erasmus closed 8 years ago

erasmus commented 8 years ago

I can't figure out exactly what but some special chars seem to break.

Try e.g.

http://localhost:8000/artboard/v1469648030/h71j8fjmc6zijslrjwsv.jpg/?cutout=dp-cutout5.png&text=%C2%B1!%20%40%20%C2%A3%20%24%25%20%20%20%5E%26%20*%20()%20_%20%2B%20..%3C%2C%3E%20%2F%3E

@avorio can you spot anything?

erasmus commented 8 years ago

And is the {{ text|urlencode:"" }} actually doing it's job?

erasmus commented 8 years ago

Comma is the issue:

Regarding your questions:

Ariel - Currently line spacing configuration isn't supported. It is on our road map to support it as well.

Thiru - The issue with the comma is that it collides with Cloudinary's functionality. Specifically commas in Cloudinary URLs are used for separating between different transformation parameters (e.g., w_100,h_100 ...). So if the regular comma (or even its %2C escaped version) is used, Cloudinary thinks that the next parameter is entered rather than the rest of the text string.

Therefore, you can double escape the comma ( %252C ):

http://res.cloudinary.com/dy3pxdqun/image/fetch/w_1.0/l_text:Ubuntu_65_bold:Run%252C%20Jump,g_south_west,co_white,w_210,h_100,x_5,y_5,c_pad/http://upload.wikimedia.org/wikipedia/commons/2/26/YellowLabradorLooking_new.jpg

Alternatively, you can use a special encoding of another comma ( %E2%80%9A ):

http://res.cloudinary.com/dy3pxdqun/image/fetch/w_1.0/l_text:Ubuntu_65_bold:Run%E2%80%9A%20Jump,g_south_west,co_white,w_210,h_100,x_5,y_5,c_pad/http://upload.wikimedia.org/wikipedia/commons/2/26/YellowLabradorLooking_new.jpg