Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15446597
D16396.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D16396.diff
View Options
diff --git a/src/applications/conduit/parametertype/ConduitListParameterType.php b/src/applications/conduit/parametertype/ConduitListParameterType.php
--- a/src/applications/conduit/parametertype/ConduitListParameterType.php
+++ b/src/applications/conduit/parametertype/ConduitListParameterType.php
@@ -3,6 +3,17 @@
abstract class ConduitListParameterType
extends ConduitParameterType {
+ private $allowEmptyList = true;
+
+ public function setAllowEmptyList($allow_empty_list) {
+ $this->allowEmptyList = $allow_empty_list;
+ return $this;
+ }
+
+ public function getAllowEmptyList() {
+ return $this->allowEmptyList;
+ }
+
protected function getParameterValue(array $request, $key) {
$value = parent::getParameterValue($request, $key);
@@ -27,6 +38,13 @@
pht('Expected a list, but value is an object.'));
}
+ if (!$value && !$this->getAllowEmptyList()) {
+ $this->raiseValidationException(
+ $request,
+ $key,
+ pht('Expected a nonempty list, but value is an empty list.'));
+ }
+
return $value;
}
diff --git a/src/applications/conduit/parametertype/ConduitParameterType.php b/src/applications/conduit/parametertype/ConduitParameterType.php
--- a/src/applications/conduit/parametertype/ConduitParameterType.php
+++ b/src/applications/conduit/parametertype/ConduitParameterType.php
@@ -61,7 +61,11 @@
protected function raiseValidationException(array $request, $key, $message) {
// TODO: Specialize this so we can give users more tailored messages from
// Conduit.
- throw new Exception($message);
+ throw new Exception(
+ pht(
+ 'Error while reading "%s": %s',
+ $key,
+ $message));
}
diff --git a/src/applications/search/field/PhabricatorIDsSearchField.php b/src/applications/search/field/PhabricatorIDsSearchField.php
--- a/src/applications/search/field/PhabricatorIDsSearchField.php
+++ b/src/applications/search/field/PhabricatorIDsSearchField.php
@@ -24,7 +24,8 @@
}
protected function newConduitParameterType() {
- return new ConduitIntListParameterType();
+ return id(new ConduitIntListParameterType())
+ ->setAllowEmptyList(false);
}
}
diff --git a/src/applications/search/field/PhabricatorPHIDsSearchField.php b/src/applications/search/field/PhabricatorPHIDsSearchField.php
--- a/src/applications/search/field/PhabricatorPHIDsSearchField.php
+++ b/src/applications/search/field/PhabricatorPHIDsSearchField.php
@@ -24,7 +24,8 @@
}
protected function newConduitParameterType() {
- return new ConduitPHIDListParameterType();
+ return id(new ConduitPHIDListParameterType())
+ ->setAllowEmptyList(false);
}
}
diff --git a/src/applications/search/field/PhabricatorSearchDatasourceField.php b/src/applications/search/field/PhabricatorSearchDatasourceField.php
--- a/src/applications/search/field/PhabricatorSearchDatasourceField.php
+++ b/src/applications/search/field/PhabricatorSearchDatasourceField.php
@@ -22,7 +22,8 @@
protected function newConduitParameterType() {
if (!$this->conduitParameterType) {
- return new ConduitStringListParameterType();
+ return id(new ConduitStringListParameterType())
+ ->setAllowEmptyList(false);
}
return $this->conduitParameterType;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 7:37 PM (2 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7725655
Default Alt Text
D16396.diff (3 KB)
Attached To
Mode
D16396: Don't allow empty list constraints in Conduit calls
Attached
Detach File
Event Timeline
Log In to Comment