[Bps-public-commit] smokingit branch, master, updated. 703db9e64a7b12fe3bc6991b2a41a02b58955201

Alex Vandiver alexmv at bestpractical.com
Mon Jan 6 23:01:16 EST 2014


The branch, master has been updated
       via  703db9e64a7b12fe3bc6991b2a41a02b58955201 (commit)
      from  5bf47c1be3895de7e55878a76cef262391765f15 (commit)

Summary of changes:
 lib/Smokingit/View/GitHub.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 703db9e64a7b12fe3bc6991b2a41a02b58955201
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 6 23:00:05 2014 -0500

    Revert "Revert "Ensure that decode_json gets bytes, like it expects""
    
    This reverts commit a4ce468aa37c9c207621ec5ebe77710c5132482a.  There is
    both a Web::Hippie encoding hiccup as _well_ as Github sending utf-8
    encoded data, which we were already decoding into characters.

diff --git a/lib/Smokingit/View/GitHub.pm b/lib/Smokingit/View/GitHub.pm
index 3c7b6f4..7afeb74 100644
--- a/lib/Smokingit/View/GitHub.pm
+++ b/lib/Smokingit/View/GitHub.pm
@@ -5,12 +5,13 @@ package Smokingit::View::GitHub;
 use Jifty::View::Declare -base;
 
 use Jifty::JSON qw/decode_json/;
+use Encode qw/encode/;
 
 template '/github' => sub {
     my $ret = eval {
         die "Wrong method\n" unless Jifty->web->request->method eq "POST";
         die "No payload\n"   unless get('payload');
-        my $json = eval { decode_json(get('payload')) }
+        my $json = eval { decode_json(encode('utf8', get('payload'))) }
             or die "Bad JSON: $@\n" . get('payload');
 
         my $name = $json->{repository}{name}

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list