damog / www-tumblr

Perl interface for the Tumblr API
https://metacpan.org/module/WWW::Tumblr
13 stars 8 forks source link

Not Building #13

Closed jacoby closed 8 years ago

jacoby commented 8 years ago

Fails in the test, on two x86 Linux machines. Perl 5.18.0 and 5.24.0.

t/02-blog_avatar.t ............ 1/? malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "\x{fffd}PNG\r\n\x{1a}...") at /home/jacoby/.cpan/build/WWW-Tumblr-5.2-UxjAuQ/blib/lib/WWW/Tumblr/API.pm line 37.

jacoby commented 8 years ago

Addendum: Tumblr API returns the PNG of the avatar, not the URL of the avatar.

jacoby commented 8 years ago

Since the API is GET-only here, I see three possibilities:

1) Adapt the API and rewrite tests to handle the PNG, perhaps using Perl::Magick to ensure that asking for size 128 returns a 128x128 PNG

2) write the module so that, when handling avatars, it returns 'https://api.tumblr.com/v2/blog/{blog}.tumblr.com/avatar/{size}' instead of what $blog->({size=>{size}}) returns

3) excise avatar functionality entirely.

I can do any of these or none of these.

damog commented 8 years ago

Thanks for reporting. Apparently the Tumblr API started responding with the image directly only very recently. It seems like using an OAuth signature is necessary even for those methods that are not necessary to authenticate. This is very annoying, but it the tests pass for now. I will be looking into rewriting some of the core methods to make this not a shitshow. Thanks Tumblr! Not.