diff options
author | Patricio Cano <suprnova32@gmail.com> | 2016-09-08 13:08:05 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2016-09-08 13:08:05 -0500 |
commit | 3c9ef9eba3a188cb7d742c4be5c75fca6ea9de80 (patch) | |
tree | 04fc43b472d8f470f9575cebd333614be41fddf1 /lib/gitlab_lfs_authentication.rb | |
parent | a070ae4a320f8da830862e1dd11eea8b1281ab8c (diff) | |
download | gitlab-shell-lfs-authenticate-support.tar.gz |
Properly rescue from JSON parse.lfs-authenticate-support
Diffstat (limited to 'lib/gitlab_lfs_authentication.rb')
-rw-r--r-- | lib/gitlab_lfs_authentication.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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 |