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

Apply hotfix

This commit is contained in:
Simon Vieille 2017-06-20 09:46:40 +02:00
commit 8a7de8a107

View File

@ -8,6 +8,7 @@ use Gist\Form\CloneGistForm;
use Gist\Model\Gist;
use GitWrapper\GitException;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Form\FormError;
/**
* Class EditController.
@ -39,9 +40,9 @@ class EditController extends Controller
$form->submit($request);
$data = $form->getData();
if (empty($form->getData()['content']) && empty($request->files)) {
$form->get('content')->addError(new FormError('form.error.not_blank'));
} elseif (empty($form->getData()['content']) && !empty($request->files)) {
if (empty($form->getData()['content']) && !$request->files->has('file')) {
$form->get('content')->addError(new FormError($app['translator']->trans('form.error.not_blank')));
} elseif (empty($form->getData()['content']) && $request->files->has('file')) {
if (count($form->get('file')->getErrors()) === 0) {
$data['content'] = file_get_contents($form->get('file')->getData()->getPathName());
unset($data['file']);