Make diffusion.filecontentquery return file PHIDs instead of raw content
Summary: Fixes T9319. Proxied requests (e.g., in the cluster) for binary files (like images) currently fail because we can not return binary data over Conduit in JSON. Although Conduit will eventually support binary-safe encodings, a cleaner approach to this is just to return a `filePHID` instead of the raw content. This is generally faster and more flexible, and gives us more opportunities to add caching later. After making the call, the client pulls the file data separately. We also no longer need to return a complex data structure because we don't do blame over this call any longer. Test Plan: - Viewed images in Diffusion. - Viewed READMEs in Diffusion. - Used `bin/differential attach-commit rX Dy` to hit attach pathway. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9319 Differential Revision: https://secure.phabricator.com/D14970
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery {
|
||||
|
||||
public function getFileContentFuture() {
|
||||
protected function getFileContentFuture() {
|
||||
$drequest = $this->getRequest();
|
||||
|
||||
$repository = $drequest->getRepository();
|
||||
@@ -15,13 +15,9 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery {
|
||||
$path);
|
||||
}
|
||||
|
||||
protected function executeQueryFromFuture(Future $future) {
|
||||
protected function resolveFileContentFuture(Future $future) {
|
||||
list($corpus) = $future->resolvex();
|
||||
|
||||
$file_content = new DiffusionFileContent();
|
||||
$file_content->setCorpus($corpus);
|
||||
|
||||
return $file_content;
|
||||
return $corpus;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user