[Bps-public-commit] smokingit branch, master, updated. 018e5b57b68810e0c35286fd37ec8304982c37ab

Alex Vandiver alexmv at bestpractical.com
Thu Nov 21 13:44:45 EST 2013


The branch, master has been updated
       via  018e5b57b68810e0c35286fd37ec8304982c37ab (commit)
      from  1f19ab7d711cb49d6f4402a2dbc908d8ced68ef0 (commit)

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

- Log -----------------------------------------------------------------
commit 018e5b57b68810e0c35286fd37ec8304982c37ab
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Nov 21 13:44:41 2013 -0500

    Ensure that decode_json gets bytes, like it expects

diff --git a/lib/Smokingit/View/GitHub.pm b/lib/Smokingit/View/GitHub.pm
index e510c3f..7afeb74 100644
--- a/lib/Smokingit/View/GitHub.pm
+++ b/lib/Smokingit/View/GitHub.pm
@@ -5,13 +5,14 @@ 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')) }
-            or die "Bad JSON: $@\n";
+        my $json = eval { decode_json(encode('utf8', get('payload'))) }
+            or die "Bad JSON: $@\n" . get('payload');
 
         my $name = $json->{repository}{name}
             or die "No repository name found\n";

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



More information about the Bps-public-commit mailing list