Kill PhabricatorFileURI
Summary: we used to need this function for security purposes, but no longer need it. remove it so that some call sites can be optimized via smarter data fetching, and so the whole codebase can have one less thing in it. Test Plan: verified the images displayed properly for each of the following - viewed a diff with added images. - viewed a user feed - viewed a user profile - viewed all image macros - viewed a paste and clicked through "raw link" weakness in testing around proxy files and transformed files. not sure what these are. changes here are very programmatic however. Reviewers: epriestley Reviewed By: epriestley CC: aran, btrahan, epriestley Maniphest Tasks: T672 Differential Revision: https://secure.phabricator.com/D1354
This commit is contained in:
@@ -867,7 +867,6 @@ class DifferentialChangesetParser {
|
||||
$range_len = null,
|
||||
$mask_force = array()) {
|
||||
|
||||
|
||||
// "Top level" renders are initial requests for the whole file, versus
|
||||
// requests for a specific range generated by clicking "show more". We
|
||||
// generate property changes and "shield" UI elements only for toplevel
|
||||
@@ -915,21 +914,37 @@ class DifferentialChangesetParser {
|
||||
}
|
||||
|
||||
if ($old_phid || $new_phid) {
|
||||
|
||||
// grab the files, (micro) optimization for 1 query not 2
|
||||
$file_phids = array();
|
||||
if ($old_phid) {
|
||||
$old_uri = PhabricatorFileURI::getViewURIForPHID($old_phid);
|
||||
$old = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $old_uri,
|
||||
));
|
||||
$file_phids[] = $old_phid;
|
||||
}
|
||||
if ($new_phid) {
|
||||
$new_uri = PhabricatorFileURI::getViewURIForPHID($new_phid);
|
||||
$cur = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $new_uri,
|
||||
));
|
||||
$file_phids[] = $new_phid;
|
||||
}
|
||||
|
||||
$files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid IN (%Ls)',
|
||||
$file_phids);
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (empty($file)) {
|
||||
continue;
|
||||
}
|
||||
if ($file->getPHID() == $old_phid) {
|
||||
$old = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $file->getBestURI(),
|
||||
));
|
||||
} else {
|
||||
$cur = phutil_render_tag(
|
||||
'img',
|
||||
array(
|
||||
'src' => $file->getBestURI(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user