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:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -184,6 +184,11 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
||||
$transformations = id(new PhabricatorTransformedFile())->loadAllWhere(
|
||||
'originalPHID = %s',
|
||||
$file->getPHID());
|
||||
$transformed_phids = mpull($transformations, 'getTransformedPHID');
|
||||
$transformed_files = id(new PhabricatorFile())->loadAllWhere(
|
||||
'phid in (%Ls)',
|
||||
$transformed_phids);
|
||||
$transformed_map = mpull($transformed_files, null, 'getPHID');
|
||||
$rows = array();
|
||||
foreach ($transformations as $transformed) {
|
||||
$phid = $transformed->getTransformedPHID();
|
||||
@@ -192,7 +197,7 @@ class PhabricatorFileViewController extends PhabricatorFileController {
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => PhabricatorFileURI::getViewURIForPHID($phid),
|
||||
'href' => $transformed_map[$phid]->getBestURI(),
|
||||
),
|
||||
$phid));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user