diff --git a/js/script.js b/js/script.js index 04878d2e9..06aebd909 100755 --- a/js/script.js +++ b/js/script.js @@ -253,7 +253,7 @@ $(function(){ for (var i = 0; i < activity.previews.length; i++) { var preview = activity.previews[i]; content += ((preview.link) ? '' + "\n" : '') - + '' + t('activity', 'Open file') + '' + "\n" + + '' + t('activity', 'Open {filename}', preview) + '' + "\n" + ((preview.link) ? '' + "\n" : '') } content += ''; diff --git a/lib/Controller/APIv2Controller.php b/lib/Controller/APIv2Controller.php index faef30721..0fcb7171c 100644 --- a/lib/Controller/APIv2Controller.php +++ b/lib/Controller/APIv2Controller.php @@ -363,6 +363,7 @@ protected function getPreview(string $owner, int $fileId, string $filePath): arr 'isMimeTypeIcon' => true, 'fileId' => $fileId, 'view' => $info['view'] ?: 'files', + 'filename' => basename($filePath), ]; // show a preview image if the file still exists @@ -401,6 +402,7 @@ protected function getPreviewFromPath(int $fileId, string $filePath, array $info 'isMimeTypeIcon' => true, 'fileId' => $fileId, 'view' => $info['view'] ?: 'files', + 'filename' => basename($filePath), ]; } diff --git a/tests/Controller/APIv2ControllerTest.php b/tests/Controller/APIv2ControllerTest.php index 40389f74f..cdb49053a 100644 --- a/tests/Controller/APIv2ControllerTest.php +++ b/tests/Controller/APIv2ControllerTest.php @@ -765,6 +765,7 @@ public function testGetPreview(string $author, int $fileId, string $path, string 'isMimeTypeIcon' => $isMimeTypeIcon, 'fileId' => $fileId, 'view' => 'files', + 'filename' => basename($path), ]); } @@ -775,6 +776,7 @@ public function testGetPreview(string $author, int $fileId, string $path, string 'isMimeTypeIcon' => $isMimeTypeIcon, 'fileId' => $fileId, 'view' => 'files', + 'filename' => basename($path), ], self::invokePrivate($controller, 'getPreview', [$author, $fileId, $path])); } @@ -820,6 +822,7 @@ public function testGetPreviewFromPath(int $fileId, string $filePath, string $mi 'isMimeTypeIcon' => true, 'fileId' => $fileId, 'view' => $view ?: 'files', + 'filename' => basename($filePath), ], self::invokePrivate($controller, 'getPreviewFromPath', [$fileId, $filePath, ['path' => $filePath, 'is_dir' => $isDir, 'view' => $view]]) );