diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 170b20d7c2760d7f047b69903d0eff281cfba03c..c55982827b3c5ea1200f5c9fe0ec2e15ca9c8732 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -206,7 +206,7 @@ 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]), ]; } diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php index 8047eb1319eacc773ec5a26f71bb8144ab87969b..ed00d50f221fd7d07d8de6f6f42667d1299617a5 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 92686ec0c36af22990d559f335a1d09f74c3f565..ae303034610cccc004ef36fa1e077b579b4dd794 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]), ]; } diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php index e1a25156441948de6346173041e20ee080e2a734..01012e4785b2a14541044bb0af4d5d8dfb1676cc 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -187,7 +187,7 @@ class Downloads implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php index 326ebba9ef70580437d072b14d7ce02ad4dee142..6c25572d0d452c9b5d0b4393c4cb808cb2a2e010 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -232,7 +232,7 @@ class Groups implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php index ec8152c5a328a8e41103baca9d03f7b6860a05e9..20070970bcaf50034eeaf802a7a06cc02794858b 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -239,7 +239,7 @@ class PublicLinks implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php index d85eeadc31575cdca7d69be8de4a8c84d1ac69c7..4db72136a85d44f05972bb49df95d515b97598ba 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -260,7 +260,7 @@ class Users implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index 5342d013adea917dee17287102f2738b12e08e84..1c2f37dc38241a1ad3ab9fdcba1966dd8cf3d28a 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -196,7 +196,7 @@ class Activity implements IProvider { 'type' => 'file', 'id' => $id, 'name' => basename($path), - 'path' => $path, + 'path' => trim($path, '/'), 'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]), ]; } diff --git a/lib/public/RichObjectStrings/Definitions.php b/lib/public/RichObjectStrings/Definitions.php index fbde439c47aa4474ad59d0a17061705c17158334..4b5b0da978ef74035bb949dafa7e74225ab1385d 100644 --- a/lib/public/RichObjectStrings/Definitions.php +++ b/lib/public/RichObjectStrings/Definitions.php @@ -191,7 +191,7 @@ class Definitions { 'path' => [ 'since' => '11.0.0', 'required' => true, - 'description' => 'The full path of the file for the user', + 'description' => 'The full path of the file for the user, should not start with a slash', 'example' => 'path/to/file.txt', ], 'link' => [