mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Raise a better error when a file upload fails in Differential
Summary: Ref T2296. If a file upload fails (e.g., too large), we read the textarea from the "Create New Diff" interface. This means we show the user an error like "empty diff" when we should show them an error like "file upload failed, patch is too large". This is part of the issue in T2296, which features a 2.5MB diff. Instead, check if a file was specified, so we'll raise a better error. Test Plan: Tried to upload a large patch, got a "file is too large" error instead of an empty-diff-related error. Reviewers: btrahan, vrana, codeblock Reviewed By: codeblock CC: aran Maniphest Tasks: T2296 Differential Revision: https://secure.phabricator.com/D4369
This commit is contained in:
parent
cdaf898b9c
commit
f12dbe36d6
1 changed files with 3 additions and 2 deletions
|
@ -8,9 +8,10 @@ final class DifferentialDiffCreateController extends DifferentialController {
|
|||
|
||||
if ($request->isFormPost()) {
|
||||
$diff = null;
|
||||
try {
|
||||
|
||||
if ($request->getFileExists('diff-file')) {
|
||||
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
|
||||
} catch (Exception $ex) {
|
||||
} else {
|
||||
$diff = $request->getStr('diff');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue