mirror of
https://github.com/Yetangitu/owncloud-apps.git
synced 2025-10-02 14:49:17 +02:00
files_reader: #40, replace sharetoken regexp with one including a non-capturing group for /index.php to support short-URL installations
This commit is contained in:
parent
f5fabafa65
commit
2afaf05106
1 changed files with 11 additions and 2 deletions
|
@ -104,9 +104,18 @@ class PageController extends Controller {
|
||||||
'annotations' => $this->toJson($this->bookmarkService->get($fileId))
|
'annotations' => $this->toJson($this->bookmarkService->get($fileId))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$policy = new ContentSecurityPolicy();
|
||||||
|
$policy->addAllowedStyleDomain('\'self\'');
|
||||||
|
$policy->addAllowedStyleDomain('blob:');
|
||||||
|
$policy->addAllowedScriptDomain('\'self\'');
|
||||||
|
$policy->addAllowedFrameDomain('\'self\'');
|
||||||
|
$policy->addAllowedChildSrcDomain('\'self\'');
|
||||||
|
$policy->addAllowedFontDomain('\'self\'');
|
||||||
|
$policy->addAllowedFontDomain('data:');
|
||||||
|
$policy->addAllowedImageDomain('blob:');
|
||||||
|
|
||||||
$response = new TemplateResponse($this->appName, $template, $params, 'blank');
|
$response = new TemplateResponse($this->appName, $template, $params, 'blank');
|
||||||
|
$response->setContentSecurityPolicy($policy);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +130,7 @@ class PageController extends Controller {
|
||||||
*/
|
*/
|
||||||
private function getFileInfo($path) {
|
private function getFileInfo($path) {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$shareToken = preg_replace("/\/index\.php\/s\/([A-Za-z0-9]{15})\/download/", "$1", $path, 1,$count);
|
$shareToken = preg_replace("/(?:\/index\.php)?\/s\/([A-Za-z0-9]{15})\/download/", "$1", $path, 1,$count);
|
||||||
if ($count === 1) {
|
if ($count === 1) {
|
||||||
$node = $this->shareManager->getShareByToken($shareToken)->getNode();
|
$node = $this->shareManager->getShareByToken($shareToken)->getNode();
|
||||||
$filePath = $node->getPath();
|
$filePath = $node->getPath();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue