2
2
Fork 3

Fix issue with API: the client requested 'list' instead of 'update' for updating gist and the update controller found bad gist

Dieser Commit ist enthalten in:
Simon Vieille 2018-08-08 09:38:51 +02:00
Ursprung acf48c4a75
Commit 31ffaced48
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 919533E2B946EA10
2 geänderte Dateien mit 11 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -88,7 +88,7 @@ class Client extends BaseClient
public function update($gist, $content)
{
$response = $this->post(
str_replace('{gist}', $gist, $this->mergeApiKey(self::LIST)),
str_replace('{gist}', $gist, $this->mergeApiKey(self::UPDATE)),
array(
'form_params' => array(
'form' => array(

Datei anzeigen

@ -158,12 +158,16 @@ class ApiController extends Controller
return $this->invalidMethodResponse('POST method is required.');
}
$gist = GistQuery::create()
->filterByCipher(false)
->filterById((int) $gist)
->_or()
->filterByFile($gist)
->findOne();
$query = GistQuery::create()
->filterByCipher(false);
if (ctype_digit($gist)) {
$query->filterById((int) $gist);
} else {
$query->filterByFile($gist);
}
$gist = $query->findOne();
if (!$gist) {
return $this->invalidRequestResponse('Invalid Gist');