summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatricio Cano <suprnova32@gmail.com>2016-09-08 13:08:05 -0500
committerPatricio Cano <suprnova32@gmail.com>2016-09-08 13:08:05 -0500
commit3c9ef9eba3a188cb7d742c4be5c75fca6ea9de80 (patch)
tree04fc43b472d8f470f9575cebd333614be41fddf1
parenta070ae4a320f8da830862e1dd11eea8b1281ab8c (diff)
downloadgitlab-shell-lfs-authenticate-support.tar.gz
Properly rescue from JSON parse.lfs-authenticate-support
-rw-r--r--lib/gitlab_lfs_authentication.rb8
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