1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Truncate Conduit 'clientDescription' so we don't overflow the column

Summary: We store the `arc` commandline in this 255-character column, but it can be more than 255-characters long. If it's huge, truncate it.

Test Plan:
Executed:

  arc list --conduit-uri=http://local.aphront.com:8080/ --conduit-version 6.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Works fine after this patch.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D8327
This commit is contained in:
epriestley 2014-02-25 12:35:03 -08:00
parent f0e6dc1221
commit 72a062d802

View file

@ -61,6 +61,9 @@ final class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
$client = $request->getValue('client'); $client = $request->getValue('client');
$client_version = (int)$request->getValue('clientVersion'); $client_version = (int)$request->getValue('clientVersion');
$client_description = (string)$request->getValue('clientDescription'); $client_description = (string)$request->getValue('clientDescription');
// TODO: This should be character-oriented, not display-oriented.
// See T3307.
$client_description = phutil_utf8_shorten($client_description, 255);
$username = (string)$request->getValue('user'); $username = (string)$request->getValue('user');
// Log the connection, regardless of the outcome of checks below. // Log the connection, regardless of the outcome of checks below.