From 6be8d65763eebbb49fbb724d7bc08e7df94299b7 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 30 Aug 2014 07:19:47 -0700 Subject: [PATCH] Convert two missed phutil_utf8_shorten() callsites Summary: Fixes T6006. These didn't get caught by D10392. Test Plan: Forced migration to re-run; ran SSH commands against Phabricator. Auditors: btrahan --- resources/sql/patches/20131121.repocredentials.2.mig.php | 7 ++++++- scripts/ssh/ssh-exec.php | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/resources/sql/patches/20131121.repocredentials.2.mig.php b/resources/sql/patches/20131121.repocredentials.2.mig.php index 95fd9a43fa..bcace810ec 100644 --- a/resources/sql/patches/20131121.repocredentials.2.mig.php +++ b/resources/sql/patches/20131121.repocredentials.2.mig.php @@ -67,9 +67,14 @@ foreach ($map as $credential_type => $credential_usernames) { foreach ($credential_usernames as $username => $credential_secrets) { foreach ($credential_secrets as $secret_plaintext => $repositories) { $callsigns = mpull($repositories, 'getCallsign'); + + $signs = implode(', ', $callsigns); + $name = pht( 'Migrated Repository Credential (%s)', - phutil_utf8_shorten(implode(', ', $callsigns), 128)); + id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(128) + ->truncateString($signs)); echo "Creating: {$name}...\n"; diff --git a/scripts/ssh/ssh-exec.php b/scripts/ssh/ssh-exec.php index 395ae4bd9a..2e57efb6b8 100755 --- a/scripts/ssh/ssh-exec.php +++ b/scripts/ssh/ssh-exec.php @@ -82,12 +82,15 @@ try { implode(', ', $workflow_names))); } + $log_argv = implode(' ', array_slice($original_argv, 1)); + $log_argv = id(new PhutilUTF8StringTruncator()) + ->setMaximumCodepoints(128) + ->truncateString($log_argv); + $ssh_log->setData( array( 'C' => $original_argv[0], - 'U' => phutil_utf8_shorten( - implode(' ', array_slice($original_argv, 1)), - 128), + 'U' => $log_argv, )); $command = head($original_argv);