mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Fix external redirect flagging issue with image thumbnails
Summary: Fixes T5894. This needs some improvement when we lay in real CDN stuff, but should get all the cases right for now. Test Plan: Thumbnails work properly again. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T5894 Differential Revision: https://secure.phabricator.com/D10299
This commit is contained in:
parent
ed98a1cc84
commit
e8c51cd934
1 changed files with 15 additions and 1 deletions
|
@ -149,7 +149,21 @@ final class PhabricatorFileTransformController
|
||||||
// TODO: We could just delegate to the file view controller instead,
|
// TODO: We could just delegate to the file view controller instead,
|
||||||
// which would save the client a roundtrip, but is slightly more complex.
|
// which would save the client a roundtrip, but is slightly more complex.
|
||||||
$uri = $file->getBestURI();
|
$uri = $file->getBestURI();
|
||||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
|
||||||
|
// TODO: This is a bit iffy. Sometimes, getBestURI() returns a CDN URI
|
||||||
|
// (if the file is a viewable image) and sometimes a local URI (if not).
|
||||||
|
// For now, just detect which one we got and configure the response
|
||||||
|
// appropriately. In the long run, if this endpoint is served from a CDN
|
||||||
|
// domain, we can't issue a local redirect to an info URI (which is not
|
||||||
|
// present on the CDN domain). We probably never actually issue local
|
||||||
|
// redirects here anyway, since we only ever transform viewable images
|
||||||
|
// right now.
|
||||||
|
|
||||||
|
$is_external = strlen(id(new PhutilURI($uri))->getDomain());
|
||||||
|
|
||||||
|
return id(new AphrontRedirectResponse())
|
||||||
|
->setIsExternal($is_external)
|
||||||
|
->setURI($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function executePreviewTransform(PhabricatorFile $file, $size) {
|
private function executePreviewTransform(PhabricatorFile $file, $size) {
|
||||||
|
|
Loading…
Reference in a new issue