Merge pull request #14702 from ptibogxiv/patch-357
FIX API variable error code return
This commit is contained in:
commit
c633e9dc6f
@ -1413,7 +1413,7 @@ class Setup extends DolibarrApi
|
|||||||
* @url GET conf/{constantname}
|
* @url GET conf/{constantname}
|
||||||
*
|
*
|
||||||
* @throws RestException 403 Forbidden
|
* @throws RestException 403 Forbidden
|
||||||
* @throws RestException 500 Error Bad or unknown value for constantname
|
* @throws RestException 404 Error Bad or unknown value for constantname
|
||||||
*/
|
*/
|
||||||
public function getConf($constantname)
|
public function getConf($constantname)
|
||||||
{
|
{
|
||||||
@ -1425,7 +1425,7 @@ class Setup extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
|
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
|
||||||
throw new RestException(500, 'Error Bad or unknown value for constantname');
|
throw new RestException(404, 'Error Bad or unknown value for constantname');
|
||||||
}
|
}
|
||||||
if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $constantname)) {
|
if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $constantname)) {
|
||||||
throw new RestException(403, 'Forbidden');
|
throw new RestException(403, 'Forbidden');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user