Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13995492
D11719.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11719.id.diff
View Options
diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php
--- a/src/applications/files/application/PhabricatorFilesApplication.php
+++ b/src/applications/files/application/PhabricatorFilesApplication.php
@@ -84,7 +84,11 @@
'.*'
=> 'PhabricatorFileDataController',
'proxy/' => 'PhabricatorFileProxyController',
- 'xform/(?P<transform>[^/]+)/(?P<phid>[^/]+)/(?P<key>[^/]+)/'
+ 'xform/'.
+ '(?:@(?P<instance>[^/]+)/)?'.
+ '(?P<transform>[^/]+)/'.
+ '(?P<phid>[^/]+)/'.
+ '(?P<key>[^/]+)/'
=> 'PhabricatorFileTransformController',
'uploaddialog/' => 'PhabricatorFileUploadDialogController',
'download/(?P<phid>[^/]+)/' => 'PhabricatorFileDialogController',
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -620,46 +620,52 @@
return (string) $uri;
}
- public function getProfileThumbURI() {
- $path = '/file/xform/thumb-profile/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
+ private function getTransformedURI($transform) {
+ $parts = array();
+ $parts[] = 'file';
+ $parts[] = 'xform';
+
+ $instance = PhabricatorEnv::getEnvConfig('cluster.instance');
+ if (strlen($instance)) {
+ $parts[] = '@'.$instance;
+ }
+
+ $parts[] = $transform;
+ $parts[] = $this->getPHID();
+ $parts[] = $this->getSecretKey();
+
+ $path = implode('/', $parts);
+ $path = $path.'/';
+
return PhabricatorEnv::getCDNURI($path);
}
+ public function getProfileThumbURI() {
+ return $this->getTransformedURI('thumb-profile');
+ }
+
public function getThumb60x45URI() {
- $path = '/file/xform/thumb-60x45/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransformedURI('thumb-60x45');
}
public function getThumb160x120URI() {
- $path = '/file/xform/thumb-160x120/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransformedURI('thumb-160x120');
}
public function getPreview100URI() {
- $path = '/file/xform/preview-100/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransformedURI('preview-100');
}
public function getPreview220URI() {
- $path = '/file/xform/preview-220/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransformedURI('preview-220');
}
public function getThumb220x165URI() {
- $path = '/file/xform/thumb-220x165/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransfomredURI('thumb-220x165');
}
public function getThumb280x210URI() {
- $path = '/file/xform/thumb-280x210/'.$this->getPHID().'/'
- .$this->getSecretKey().'/';
- return PhabricatorEnv::getCDNURI($path);
+ return $this->getTransformedURI('thumb-280x210');
}
public function isViewableInBrowser() {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 1:18 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6729121
Default Alt Text
D11719.id.diff (3 KB)
Attached To
Mode
D11719: Pass instance through file transform URIs
Attached
Detach File
Event Timeline
Log In to Comment