Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15285222
D12807.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D12807.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2824,7 +2824,6 @@
'PholioImageUploadController' => 'applications/pholio/controller/PholioImageUploadController.php',
'PholioInlineController' => 'applications/pholio/controller/PholioInlineController.php',
'PholioInlineListController' => 'applications/pholio/controller/PholioInlineListController.php',
- 'PholioInlineThumbController' => 'applications/pholio/controller/PholioInlineThumbController.php',
'PholioMock' => 'applications/pholio/storage/PholioMock.php',
'PholioMockCommentController' => 'applications/pholio/controller/PholioMockCommentController.php',
'PholioMockEditController' => 'applications/pholio/controller/PholioMockEditController.php',
@@ -6311,7 +6310,6 @@
'PholioImageUploadController' => 'PholioController',
'PholioInlineController' => 'PholioController',
'PholioInlineListController' => 'PholioController',
- 'PholioInlineThumbController' => 'PholioController',
'PholioMock' => array(
'PholioDAO',
'PhabricatorMarkupInterface',
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
@@ -3,43 +3,36 @@
final class PhabricatorFileTransformController
extends PhabricatorFileController {
- private $transform;
- private $phid;
- private $key;
-
public function shouldRequireLogin() {
return false;
}
- public function willProcessRequest(array $data) {
- $this->transform = $data['transform'];
- $this->phid = $data['phid'];
- $this->key = $data['key'];
- }
-
- public function processRequest() {
- $viewer = $this->getRequest()->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
// NOTE: This is a public/CDN endpoint, and permission to see files is
// controlled by knowing the secret key, not by authentication.
+ $source_phid = $request->getURIData('phid');
$file = id(new PhabricatorFileQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
- ->withPHIDs(array($this->phid))
+ ->withPHIDs(array($source_phid))
->executeOne();
if (!$file) {
return new Aphront404Response();
}
- if (!$file->validateSecretKey($this->key)) {
+ $secret_key = $request->getURIData('key');
+ if (!$file->validateSecretKey($secret_key)) {
return new Aphront403Response();
}
+ $transform = $request->getURIData('transform');
$xform = id(new PhabricatorTransformedFile())
->loadOneWhere(
'originalPHID = %s AND transform = %s',
- $this->phid,
- $this->transform);
+ $source_phid,
+ $transform);
if ($xform) {
return $this->buildTransformedFileResponse($xform);
@@ -48,35 +41,26 @@
$type = $file->getMimeType();
if (!$file->isViewableInBrowser() || !$file->isTransformableImage()) {
- return $this->buildDefaultTransformation($file);
+ return $this->buildDefaultTransformation($file, $transform);
}
// We're essentially just building a cache here and don't need CSRF
// protection.
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
- switch ($this->transform) {
+ switch ($transform) {
case 'thumb-profile':
$xformed_file = $this->executeThumbTransform($file, 50, 50);
break;
case 'thumb-280x210':
$xformed_file = $this->executeThumbTransform($file, 280, 210);
break;
- case 'thumb-220x165':
- $xformed_file = $this->executeThumbTransform($file, 220, 165);
- break;
case 'preview-100':
$xformed_file = $this->executePreviewTransform($file, 100);
break;
case 'preview-220':
$xformed_file = $this->executePreviewTransform($file, 220);
break;
- case 'thumb-160x120':
- $xformed_file = $this->executeThumbTransform($file, 160, 120);
- break;
- case 'thumb-60x45':
- $xformed_file = $this->executeThumbTransform($file, 60, 45);
- break;
default:
return new Aphront400Response();
}
@@ -85,16 +69,18 @@
return new Aphront400Response();
}
- $xform = new PhabricatorTransformedFile();
- $xform->setOriginalPHID($this->phid);
- $xform->setTransform($this->transform);
- $xform->setTransformedPHID($xformed_file->getPHID());
- $xform->save();
+ $xform = id(new PhabricatorTransformedFile())
+ ->setOriginalPHID($source_phid)
+ ->setTransform($transform)
+ ->setTransformedPHID($xformed_file->getPHID())
+ ->save();
return $this->buildTransformedFileResponse($xform);
}
- private function buildDefaultTransformation(PhabricatorFile $file) {
+ private function buildDefaultTransformation(
+ PhabricatorFile $file,
+ $transform) {
static $regexps = array(
'@application/zip@' => 'zip',
'@image/@' => 'image',
@@ -111,16 +97,10 @@
}
}
- switch ($this->transform) {
+ switch ($transform) {
case 'thumb-280x210':
$suffix = '280x210';
break;
- case 'thumb-160x120':
- $suffix = '160x120';
- break;
- case 'thumb-60x45':
- $suffix = '60x45';
- break;
case 'preview-100':
$suffix = '.p100';
break;
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
@@ -784,14 +784,6 @@
return $this->getTransformedURI('thumb-profile');
}
- public function getThumb60x45URI() {
- return $this->getTransformedURI('thumb-60x45');
- }
-
- public function getThumb160x120URI() {
- return $this->getTransformedURI('thumb-160x120');
- }
-
public function getPreview100URI() {
return $this->getTransformedURI('preview-100');
}
@@ -800,10 +792,6 @@
return $this->getTransformedURI('preview-220');
}
- public function getThumb220x165URI() {
- return $this->getTransfomredURI('thumb-220x165');
- }
-
public function getThumb280x210URI() {
return $this->getTransformedURI('thumb-280x210');
}
diff --git a/src/applications/pholio/application/PhabricatorPholioApplication.php b/src/applications/pholio/application/PhabricatorPholioApplication.php
--- a/src/applications/pholio/application/PhabricatorPholioApplication.php
+++ b/src/applications/pholio/application/PhabricatorPholioApplication.php
@@ -49,7 +49,6 @@
'inline/' => array(
'(?:(?P<id>\d+)/)?' => 'PholioInlineController',
'list/(?P<id>\d+)/' => 'PholioInlineListController',
- 'thumb/(?P<imageid>\d+)/' => 'PholioInlineThumbController',
),
'image/' => array(
'upload/' => 'PholioImageUploadController',
diff --git a/src/applications/pholio/controller/PholioInlineThumbController.php b/src/applications/pholio/controller/PholioInlineThumbController.php
deleted file mode 100644
--- a/src/applications/pholio/controller/PholioInlineThumbController.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-final class PholioInlineThumbController extends PholioController {
-
- private $imageid;
-
- public function shouldAllowPublic() {
- return true;
- }
-
- public function willProcessRequest(array $data) {
- $this->imageid = idx($data, 'imageid');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
-
- $image = id(new PholioImage())->load($this->imageid);
-
- if ($image == null) {
- return new Aphront404Response();
- }
-
- $mock = id(new PholioMockQuery())
- ->setViewer($user)
- ->withIDs(array($image->getMockID()))
- ->executeOne();
-
- if (!$mock) {
- return new Aphront404Response();
- }
-
- $file = id(new PhabricatorFileQuery())
- ->setViewer($user)
- ->witHPHIDs(array($image->getFilePHID()))
- ->executeOne();
-
- if (!$file) {
- return new Aphront404Response();
- }
-
- return id(new AphrontRedirectResponse())->setURI($file->getThumb60x45URI());
- }
-
-}
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/default160x120.png b/webroot/rsrc/image/icon/fatcow/thumbnails/default160x120.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/default60x45.png b/webroot/rsrc/image/icon/fatcow/thumbnails/default60x45.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/image160x120.png b/webroot/rsrc/image/icon/fatcow/thumbnails/image160x120.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/image60x45.png b/webroot/rsrc/image/icon/fatcow/thumbnails/image60x45.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/pdf160x120.png b/webroot/rsrc/image/icon/fatcow/thumbnails/pdf160x120.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/pdf60x45.png b/webroot/rsrc/image/icon/fatcow/thumbnails/pdf60x45.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/zip160x120.png b/webroot/rsrc/image/icon/fatcow/thumbnails/zip160x120.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/webroot/rsrc/image/icon/fatcow/thumbnails/zip60x45.png b/webroot/rsrc/image/icon/fatcow/thumbnails/zip60x45.png
deleted file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 12:06 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225493
Default Alt Text
D12807.diff (10 KB)
Attached To
Mode
D12807: Remove unused file transforms
Attached
Detach File
Event Timeline
Log In to Comment