diff options
author | Stan Hu <stanhu@gmail.com> | 2018-09-07 15:02:26 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-09-07 15:03:13 -0700 |
commit | 524d523ed654469858a7a482d56f4d4661c61036 (patch) | |
tree | c0dca66449f02bf926668f12e3dd0307603c253c | |
parent | 6fd4f6804125c0992296d064f3c074d39efeb091 (diff) | |
download | gitlab-shell-524d523ed654469858a7a482d56f4d4661c61036.tar.gz |
Only decode result body if it has content upon custom action failure
-rw-r--r-- | lib/action/custom.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/action/custom.rb b/lib/action/custom.rb index 83ea5fc..ba0e650 100644 --- a/lib/action/custom.rb +++ b/lib/action/custom.rb @@ -116,7 +116,9 @@ module Action def raise_unsuccessful!(result) message = begin body = JSON.parse(result.body) - body['message'] || Base64.decode64(body['result']) || NO_MESSAGE_TEXT + message = body['message'] + message = Base64.decode64(body['result']) if !message && body['result'] && !body['result'].empty? + message ? message : NO_MESSAGE_TEXT rescue JSON::ParserError NO_MESSAGE_TEXT end |