From 3c9ef9eba3a188cb7d742c4be5c75fca6ea9de80 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Thu, 8 Sep 2016 13:08:05 -0500 Subject: Properly rescue from JSON parse. --- lib/gitlab_lfs_authentication.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/gitlab_lfs_authentication.rb') diff --git a/lib/gitlab_lfs_authentication.rb b/lib/gitlab_lfs_authentication.rb index 196cdd7..96d06d8 100644 --- a/lib/gitlab_lfs_authentication.rb +++ b/lib/gitlab_lfs_authentication.rb @@ -11,8 +11,12 @@ class GitlabLfsAuthentication end def self.build_from_json(json) - values = JSON.parse(json) rescue nil - self.new(values['username'], values['lfs_token'], values['repository_http_path']) + begin + values = JSON.parse(json) + self.new(values['username'], values['lfs_token'], values['repository_http_path']) + rescue + nil + end end def authentication_payload -- cgit v1.2.1