mirror of
https://gitnet.fr/deblan/gist.git
synced 2021-08-14 08:30:49 +02:00
Fix issue with API: the client requested 'list' instead of 'update' for updating gist and the update controller found bad gist
This commit is contained in:
parent
acf48c4a75
commit
31ffaced48
@ -88,7 +88,7 @@ class Client extends BaseClient
|
|||||||
public function update($gist, $content)
|
public function update($gist, $content)
|
||||||
{
|
{
|
||||||
$response = $this->post(
|
$response = $this->post(
|
||||||
str_replace('{gist}', $gist, $this->mergeApiKey(self::LIST)),
|
str_replace('{gist}', $gist, $this->mergeApiKey(self::UPDATE)),
|
||||||
array(
|
array(
|
||||||
'form_params' => array(
|
'form_params' => array(
|
||||||
'form' => array(
|
'form' => array(
|
||||||
|
@ -158,12 +158,16 @@ class ApiController extends Controller
|
|||||||
return $this->invalidMethodResponse('POST method is required.');
|
return $this->invalidMethodResponse('POST method is required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$gist = GistQuery::create()
|
$query = GistQuery::create()
|
||||||
->filterByCipher(false)
|
->filterByCipher(false);
|
||||||
->filterById((int) $gist)
|
|
||||||
->_or()
|
if (ctype_digit($gist)) {
|
||||||
->filterByFile($gist)
|
$query->filterById((int) $gist);
|
||||||
->findOne();
|
} else {
|
||||||
|
$query->filterByFile($gist);
|
||||||
|
}
|
||||||
|
|
||||||
|
$gist = $query->findOne();
|
||||||
|
|
||||||
if (!$gist) {
|
if (!$gist) {
|
||||||
return $this->invalidRequestResponse('Invalid Gist');
|
return $this->invalidRequestResponse('Invalid Gist');
|
||||||
|
Loading…
Reference in New Issue
Block a user