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.
|
||||
@@ -52,7 +52,16 @@ class PhabricatorFileProxyController extends PhabricatorFileController {
|
||||
}
|
||||
|
||||
if ($proxy) {
|
||||
$view_uri = PhabricatorFileURI::getViewURIForPHID($proxy->getFilePHID());
|
||||
$file = id(new PhabricatorFile())->loadOneWhere('phid = %s',
|
||||
$proxy->getFilePHID());
|
||||
if ($file) {
|
||||
$view_uri = $file->getBestURI();
|
||||
} else {
|
||||
$bad_phid = $proxy->getFilePHID();
|
||||
throw new Exception(
|
||||
"Unable to load file with phid {$bad_phid}."
|
||||
);
|
||||
}
|
||||
return id(new AphrontRedirectResponse())->setURI($view_uri);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user