From 6de0eb0b741ff1cf0b735480a6c2d2fbcb1e70ca Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 15 Dec 2016 15:53:48 +0100 Subject: Remove leading slash from sharing activity Signed-off-by: Joas Schilling --- apps/files/lib/Activity/FavoriteProvider.php | 5 +++-- apps/files/lib/Activity/Provider.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'apps/files') diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index 8047eb1319e..ed00d50f221 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -142,10 +142,11 @@ class FavoriteProvider implements IProvider { 'type' => 'file', 'id' => $event->getObjectId(), 'name' => basename($event->getObjectName()), - 'path' => $event->getObjectName(), + 'path' => trim($event->getObjectName(), '/'), + 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $event->getObjectId()]), ]; - $event->setParsedSubject(str_replace('{file}', trim($parameter['path'], '/'), $subject)) + $event->setParsedSubject(str_replace('{file}', $parameter['path'], $subject)) ->setRichSubject($subject, ['file' => $parameter]); } } diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php index 92686ec0c36..ae303034610 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -201,7 +201,7 @@ class Provider implements IProvider { foreach ($parameters as $placeholder => $parameter) { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'file') { - $replacements[] = trim($parameter['path'], '/'); + $replacements[] = $parameter['path']; } else { $replacements[] = $parameter['name']; } @@ -253,7 +253,8 @@ class Provider implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), + 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } -- cgit v1.2.3