Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14397571
D10299.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10299.diff
View Options
diff --git a/src/applications/files/controller/PhabricatorFileTransformController.php b/src/applications/files/controller/PhabricatorFileTransformController.php
--- a/src/applications/files/controller/PhabricatorFileTransformController.php
+++ b/src/applications/files/controller/PhabricatorFileTransformController.php
@@ -149,7 +149,21 @@
// TODO: We could just delegate to the file view controller instead,
// which would save the client a roundtrip, but is slightly more complex.
$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) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 10:47 AM (18 h, 7 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6921170
Default Alt Text
D10299.diff (1 KB)
Attached To
Mode
D10299: Fix external redirect flagging issue with image thumbnails
Attached
Detach File
Event Timeline
Log In to Comment