Skip to content

Commit f12dbe3

Browse files
author
epriestley
committed
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
1 parent cdaf898 commit f12dbe3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/applications/differential/controller/DifferentialDiffCreateController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ public function processRequest() {
88

99
if ($request->isFormPost()) {
1010
$diff = null;
11-
try {
11+
12+
if ($request->getFileExists('diff-file')) {
1213
$diff = PhabricatorFile::readUploadedFileData($_FILES['diff-file']);
13-
} catch (Exception $ex) {
14+
} else {
1415
$diff = $request->getStr('diff');
1516
}
1617

0 commit comments

Comments
 (0)