Summary: Fixes T11785. Lightbox calls `JX.Stratcom.pass()` to let other handlers react, but should not. At least today, we never put, e.g., links inside a lightbox. This code appears in the original commit so it was probably just copy/pasted from somewhere and I missed it in review. (Or there's some edge case I'm not thinking of and we'll figure it out soon enough.) Additionally, blacklist `/file/data/` from Quicksand naviagtion: Quicksand should never fetch these URIs. Test Plan: - Disabled `security.alternate-file-domain`. - Enabled Quicksand ("Persistent Chat"). - Clicked an image thumbnail on a task. - Repeated that until things flipped out a bit. - After the patch: no issues. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11785 Differential Revision: https://secure.phabricator.com/D16884
139 lines
3.7 KiB
PHP
139 lines
3.7 KiB
PHP
<?php
|
|
|
|
final class PhabricatorFilesApplication extends PhabricatorApplication {
|
|
|
|
public function getBaseURI() {
|
|
return '/file/';
|
|
}
|
|
|
|
public function getName() {
|
|
return pht('Files');
|
|
}
|
|
|
|
public function getShortDescription() {
|
|
return pht('Store and Share Files');
|
|
}
|
|
|
|
public function getIcon() {
|
|
return 'fa-file';
|
|
}
|
|
|
|
public function getTitleGlyph() {
|
|
return "\xE2\x87\xAA";
|
|
}
|
|
|
|
public function getFlavorText() {
|
|
return pht('Blob store for Pokemon pictures.');
|
|
}
|
|
|
|
public function getApplicationGroup() {
|
|
return self::GROUP_UTILITIES;
|
|
}
|
|
|
|
public function canUninstall() {
|
|
return false;
|
|
}
|
|
|
|
public function getRemarkupRules() {
|
|
return array(
|
|
new PhabricatorEmbedFileRemarkupRule(),
|
|
new PhabricatorImageRemarkupRule(),
|
|
);
|
|
}
|
|
|
|
public function supportsEmailIntegration() {
|
|
return true;
|
|
}
|
|
|
|
public function getAppEmailBlurb() {
|
|
return pht(
|
|
'Send emails with file attachments to these addresses to upload '.
|
|
'files. %s',
|
|
phutil_tag(
|
|
'a',
|
|
array(
|
|
'href' => $this->getInboundEmailSupportLink(),
|
|
),
|
|
pht('Learn More')));
|
|
}
|
|
|
|
protected function getCustomCapabilities() {
|
|
return array(
|
|
FilesDefaultViewCapability::CAPABILITY => array(
|
|
'caption' => pht('Default view policy for newly created files.'),
|
|
'template' => PhabricatorFileFilePHIDType::TYPECONST,
|
|
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
|
|
),
|
|
);
|
|
}
|
|
|
|
public function getRoutes() {
|
|
return array(
|
|
'/F(?P<id>[1-9]\d*)' => 'PhabricatorFileInfoController',
|
|
'/file/' => array(
|
|
'(query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorFileListController',
|
|
'upload/' => 'PhabricatorFileUploadController',
|
|
'dropupload/' => 'PhabricatorFileDropUploadController',
|
|
'compose/' => 'PhabricatorFileComposeController',
|
|
'comment/(?P<id>[1-9]\d*)/' => 'PhabricatorFileCommentController',
|
|
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFileDeleteController',
|
|
'edit/(?P<id>[1-9]\d*)/' => 'PhabricatorFileEditController',
|
|
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileInfoController',
|
|
'imageproxy/' => 'PhabricatorFileImageProxyController',
|
|
'transforms/(?P<id>[1-9]\d*)/' =>
|
|
'PhabricatorFileTransformListController',
|
|
'uploaddialog/(?P<single>single/)?'
|
|
=> 'PhabricatorFileUploadDialogController',
|
|
'download/(?P<phid>[^/]+)/' => 'PhabricatorFileDialogController',
|
|
'iconset/(?P<key>[^/]+)/' => array(
|
|
'select/' => 'PhabricatorFileIconSetSelectController',
|
|
),
|
|
) + $this->getResourceSubroutes(),
|
|
);
|
|
}
|
|
|
|
public function getResourceRoutes() {
|
|
return array(
|
|
'/file/' => $this->getResourceSubroutes(),
|
|
);
|
|
}
|
|
|
|
private function getResourceSubroutes() {
|
|
return array(
|
|
'data/'.
|
|
'(?:@(?P<instance>[^/]+)/)?'.
|
|
'(?P<key>[^/]+)/'.
|
|
'(?P<phid>[^/]+)/'.
|
|
'(?:(?P<token>[^/]+)/)?'.
|
|
'.*'
|
|
=> 'PhabricatorFileDataController',
|
|
'xform/'.
|
|
'(?:@(?P<instance>[^/]+)/)?'.
|
|
'(?P<transform>[^/]+)/'.
|
|
'(?P<phid>[^/]+)/'.
|
|
'(?P<key>[^/]+)/'
|
|
=> 'PhabricatorFileTransformController',
|
|
);
|
|
}
|
|
|
|
public function getMailCommandObjects() {
|
|
return array(
|
|
'file' => array(
|
|
'name' => pht('Email Commands: Files'),
|
|
'header' => pht('Interacting with Files'),
|
|
'object' => new PhabricatorFile(),
|
|
'summary' => pht(
|
|
'This page documents the commands you can use to interact with '.
|
|
'files.'),
|
|
),
|
|
);
|
|
}
|
|
|
|
public function getQuicksandURIPatternBlacklist() {
|
|
return array(
|
|
'/file/data/.*',
|
|
);
|
|
}
|
|
|
|
}
|