aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php4
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php3
-rw-r--r--core/templates/layout.public.php5
3 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
index dad1f332458..0c76f0e1742 100644
--- a/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
+++ b/apps/files_sharing/lib/DefaultPublicShareTemplateProvider.php
@@ -130,12 +130,16 @@ class DefaultPublicShareTemplateProvider implements IPublicShareTemplateProvider
'index',
);
$response->setContentSecurityPolicy($csp);
+
// If the share has a label, use it as the title
if ($share->getLabel() !== '') {
$response->setHeaderTitle($share->getLabel());
+ $response->setParams(['pageTitle' => $share->getLabel()]);
} else {
$response->setHeaderTitle($shareNode->getName());
+ $response->setParams(['pageTitle' => $shareNode->getName()]);
}
+
if ($ownerName !== '') {
$response->setHeaderDetails($this->l10n->t('shared by %s', [$ownerName]));
}
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 5d962dff4c0..bc8e5dede63 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -338,6 +338,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('shared by ownerDisplay');
@@ -477,6 +478,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('shared by ownerDisplay');
@@ -604,6 +606,7 @@ class ShareControllerTest extends \Test\TestCase {
$csp = new ContentSecurityPolicy();
$csp->addAllowedFrameDomain('\'self\'');
$expectedResponse = new PublicTemplateResponse('files', 'index');
+ $expectedResponse->setParams(['pageTitle' => $filename]);
$expectedResponse->setContentSecurityPolicy($csp);
$expectedResponse->setHeaderTitle($filename);
$expectedResponse->setHeaderDetails('');
diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php
index e2ed47d0716..bd46ee4f7fc 100644
--- a/core/templates/layout.public.php
+++ b/core/templates/layout.public.php
@@ -9,8 +9,9 @@
<head data-requesttoken="<?php p($_['requesttoken']); ?>">
<meta charset="utf-8">
<title>
- <?php
- p(!empty($_['application']) ? $_['application'] . ' - ' : '');
+ <?php
+ p(!empty($_['pageTitle']) && $_['pageTitle'] !== $_['application'] ? $_['pageTitle'] . ' - ' : '');
+p(!empty($_['application']) ? $_['application'] . ' - ' : '');
p($theme->getTitle());
?>
</title>