URL2PNG generates incomplete URL
In my Django application I'm using URL2PNG to generate a signed URL which works great, except that the end of the domain gets cut off all the time. It doesn't show the domain ending, e.g. .com.
See example below:
http://res.cloudinary.com/eventtech/image/url2png/s--W9DAigHXV--/c_fill,g_center,h_150,w_250/http://crowdconnected <--- END ALWAYS GETS CUT OFF
If I add it manually it works fine.
Any idea why that could be?
-
Hi Carsten,
Will you be able to share the full URL and the code you used to generate the URL?
0 -
Hi Itay,
This is how I did it:
Model
https://pastebin.com/embed_js/k9DV8jYF
View
https://pastebin.com/embed_js/NLauWhLS
(relevant in the view is the part where I'm calling the get_screenshot method to save the url as an image.)
URL that gets generated
(I changed the signature in this example)
I assume it might have to do with the CloudinaryField in my model, because if I save it as a regular CharField is saves the complete URL. Feeling a bit stuck here as quite new to Django and programming in general and any help would be greatly appreciated.
0 -
Hi Carsten,
Thanks for the details.
I couldn't reproduce your issue.
Can you please share the full URL you're trying to screenshot (i.e., "http://crowdconnected....") to further investigate?
0 -
Hi Maor,
An example of a website I'm trying to get a screenshot for is http:/www.crowdconnected.com, but I've also tried it with other URLs with the same issue. Just can't figure it out why it's cutting off the .com
0 -
Hi,
Thanks for sharing the URL. It works well for me when trying to print and access the generated URL.
Where do you get the faulty URL -
Is it after creating it (i.e., the 'signed_url' value is corrupted) or after fetching it from the listing object?
Can you share the relevant code for the above?
Thanks
0 -
Here's my view:
https://pastebin.com/embed_js/NLauWhLS
Simplifying, I'm doing the following:
1) Form sends website URL from user to View
2) Save the website field in the URL variable called url
3) Pass in the url variable to the get_screenshot method and set the result equal to the image field in my model, which is of type cloudinary.models.CloudinaryField
4) Get_screenshot method returns a signed URL, but a faulty one with the domain ending missing.
It seems I'm getting the faulty URL after creating it as the url itself is fine.
I really don't know how to better describe this. :(
Carsten
0 -
Hi,
Thanks for the additional input.
The faulty URL returns in the get_screenshot method so it's weird that it gets corrupted in case of a FileField and not on CharField.
Can you try to update your SDK to the latest version (you can get it here) and see if it solves it?
In any case, because you're saving the entire URL in listing.image, I think it's better to have it as a CharField rather than a FileField (after the url assignment the field holds a regular string).
Makes sense?
Let me know of any updates.
0
Post is closed for comments.
Comments
7 comments