Fixed issue 142, control the patch when creating a new code review.

This commit is contained in:
Loic d'Anterroches 2009-02-26 11:09:38 +01:00
parent 4d3812fc35
commit 32dc829a41

View File

@ -108,6 +108,17 @@ class IDF_Form_ReviewCreate extends Pluf_Form
}
}
public function clean_patch()
{
$diff = new IDF_Diff(file_get_contents(Pluf::f('upload_issue_path').'/'
.$this->cleaned_data['patch']));
$diff->parse();
if (count($diff->files) == 0) {
throw new Pluf_Form_Invalid(__('We were not able to parse your patch. Please provide a valid patch.'));
}
return $this->cleaned_data['patch'];
}
public function clean_commit()
{
$commit = self::findCommit($this->cleaned_data['commit']);