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

Add "uri" to the API results for File objects

Summary: Ref T13528. This supports "arc upload --browse ...".

Test Plan: Called "file.search", saw URIs in results.

Maniphest Tasks: T13528

Differential Revision: https://secure.phabricator.com/D21204
This commit is contained in:
epriestley 2020-05-01 09:08:07 -07:00
parent fbbd2e35cb
commit eab561bb87

View file

@ -1655,9 +1655,13 @@ final class PhabricatorFile extends PhabricatorFileDAO
->setKey('name') ->setKey('name')
->setType('string') ->setType('string')
->setDescription(pht('The name of the file.')), ->setDescription(pht('The name of the file.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('uri')
->setType('uri')
->setDescription(pht('View URI for the file.')),
id(new PhabricatorConduitSearchFieldSpecification()) id(new PhabricatorConduitSearchFieldSpecification())
->setKey('dataURI') ->setKey('dataURI')
->setType('string') ->setType('uri')
->setDescription(pht('Download URI for the file data.')), ->setDescription(pht('Download URI for the file data.')),
id(new PhabricatorConduitSearchFieldSpecification()) id(new PhabricatorConduitSearchFieldSpecification())
->setKey('size') ->setKey('size')
@ -1669,6 +1673,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
public function getFieldValuesForConduit() { public function getFieldValuesForConduit() {
return array( return array(
'name' => $this->getName(), 'name' => $this->getName(),
'uri' => PhabricatorEnv::getURI($this->getURI()),
'dataURI' => $this->getCDNURI('data'), 'dataURI' => $this->getCDNURI('data'),
'size' => (int)$this->getByteSize(), 'size' => (int)$this->getByteSize(),
); );