mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
Truncate large strings in DarkConsole
Summary: Ref T8597. If a page issues a large query (like inserting a blob into file storage), we may try to utf8ize the entire thing. This is slow and pointless. Instead, truncate tab data after 4096 bytes before sanitizing. Test Plan: Adjusted limit to 256 bytes, saw long queries get truncated reasonably. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8597 Differential Revision: https://secure.phabricator.com/D13347
This commit is contained in:
parent
e291b90641
commit
2eb73619d1
1 changed files with 7 additions and 0 deletions
|
@ -127,6 +127,13 @@ final class DarkConsoleCore extends Phobject {
|
|||
}
|
||||
return $data;
|
||||
} else {
|
||||
// Truncate huge strings. Since the data doesn't really matter much,
|
||||
// just truncate bytes to avoid PhutilUTF8StringTruncator overhead.
|
||||
$length = strlen($data);
|
||||
$max = 4096;
|
||||
if ($length > $max) {
|
||||
$data = substr($data, 0, $max).'...<'.$length.' bytes>...';
|
||||
}
|
||||
return phutil_utf8ize($data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue