Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/controller/PhabricatorConduitAPIController.php
Context not available. | |||||
} | } | ||||
$token_string = idx($metadata, 'token'); | $token_string = idx($metadata, 'token'); | ||||
if (strlen($token_string)) { | if (@strlen($token_string)) { | ||||
if (strlen($token_string) != 32) { | if (@strlen($token_string) != 32) { | ||||
return array( | return array( | ||||
'ERR-INVALID-AUTH', | 'ERR-INVALID-AUTH', | ||||
pht( | pht( | ||||
Context not available. | |||||
); | ); | ||||
} | } | ||||
$type = head(explode('-', $token_string)); | $type = head(@explode('-', $token_string)); | ||||
$valid_types = PhabricatorConduitToken::getAllTokenTypes(); | $valid_types = PhabricatorConduitToken::getAllTokenTypes(); | ||||
$valid_types = array_fuse($valid_types); | $valid_types = array_fuse($valid_types); | ||||
if (empty($valid_types[$type])) { | if (empty($valid_types[$type])) { | ||||
Context not available. | |||||
$value = 'null'; | $value = 'null'; | ||||
} | } | ||||
$decoded_value = json_decode($value, true); | $decoded_value = json_decode($value, true); | ||||
if ($decoded_value === null && strtolower($value) != 'null') { | if ($decoded_value === null && @strtolower($value) != 'null') { | ||||
// When json_decode() fails, it returns null. This almost certainly | // When json_decode() fails, it returns null. This almost certainly | ||||
// indicates that a user was using the web UI and didn't put quotes | // indicates that a user was using the web UI and didn't put quotes | ||||
// around a string value. We can either do what we think they meant | // around a string value. We can either do what we think they meant | ||||
Context not available. | |||||
// Otherwise, look for a single parameter called 'params' which has the | // Otherwise, look for a single parameter called 'params' which has the | ||||
// entire param dictionary JSON encoded. | // entire param dictionary JSON encoded. | ||||
$params_json = $request->getStr('params'); | $params_json = $request->getStr('params'); | ||||
if (strlen($params_json)) { | if (@strlen($params_json)) { | ||||
$params = null; | $params = null; | ||||
try { | try { | ||||
$params = phutil_json_decode($params_json); | $params = phutil_json_decode($params_json); | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0