1
0
mirror of https://gitnet.fr/deblan/gist.git synced 2021-08-14 08:30:49 +02:00

Merge branch 'dev-master' into feature/composer

This commit is contained in:
Simon Vieille 2018-08-08 11:26:09 +02:00
commit e30571c6b7
3 changed files with 45 additions and 41 deletions

View File

@ -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(

View File

@ -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');