mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Truncate the one-line diff update summary when updating a revision to 250 bytes
Summary: Fixes T7899. If you create or update a revision and type an enormously long first line, we currently fatal trying to insert it into the database. This text is only used to show a single-line summary of the diff in the "History" tab, which should probably be updated anyway. For now, stop fataling. Test Plan: Uploaded a diff with the description "MMMM..." (thousands of them). Before patch: fatal on description being too long. After patch: beautiful "MMMM" summary. Reviewers: chad Reviewed By: chad Maniphest Tasks: T7899 Differential Revision: https://secure.phabricator.com/D17038
This commit is contained in:
parent
9d2feacfab
commit
fc6bfbdb10
1 changed files with 8 additions and 1 deletions
|
@ -124,8 +124,15 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod {
|
|||
$message = $request->getValue('message');
|
||||
if (strlen($message)) {
|
||||
// This is a little awkward, and should maybe move inside the transaction
|
||||
// editor. It largely exists for legacy reasons.
|
||||
// editor. It largely exists for legacy reasons. See some discussion in
|
||||
// T7899.
|
||||
$first_line = head(phutil_split_lines($message, false));
|
||||
|
||||
$first_line = id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumBytes(250)
|
||||
->setMaximumGlyphs(80)
|
||||
->truncateString($first_line);
|
||||
|
||||
$diff->setDescription($first_line);
|
||||
$diff->save();
|
||||
|
||||
|
|
Loading…
Reference in a new issue