Page MenuHomePhabricator

D20727.diff
No OneTemporary

D20727.diff

diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
@@ -119,8 +119,11 @@
break;
}
+ $source_path = $request->getValue('sourcePath');
+ $source_path = $this->normalizeSourcePath($source_path);
+
$diff_data_dict = array(
- 'sourcePath' => $request->getValue('sourcePath'),
+ 'sourcePath' => $source_path,
'sourceMachine' => $request->getValue('sourceMachine'),
'branch' => $request->getValue('branch'),
'creationMethod' => $request->getValue('creationMethod'),
@@ -158,4 +161,18 @@
);
}
+ private function normalizeSourcePath($source_path) {
+ // See T13385. This property is probably headed for deletion. Until we get
+ // there, stop errors arising from running "arc diff" in a working copy
+ // with too many characters.
+
+ $max_size = id(new DifferentialDiff())
+ ->getColumnMaximumByteLength('sourcePath');
+
+ return id(new PhutilUTF8StringTruncator())
+ ->setMaximumBytes($max_size)
+ ->setTerminator('')
+ ->truncateString($source_path);
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Thu, May 9, 9:22 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277870
Default Alt Text
D20727.diff (1 KB)

Event Timeline