aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/PreviewController.php
Commit message (Collapse)AuthorAgeFilesLines
* fix(OpenAPI): Adjust array syntax to avoid ambiguitiesfix/openapi/array-syntaxprovokateurin2024-11-051-3/+3
| | | | Signed-off-by: provokateurin <kate@provokateurin.de>
* fix: Adjust preview for view-only sharesfix/view-only-previewFerdinand Thiessen2024-10-281-4/+9
| | | | | | | | | | | | | | | | | Previously there was a different behavior for public shares (link-shares) and internal shares, if the user disabled the view permission. The legacy UI for public shares simply "disabled" the context menu and hided all download actions. With Nextcloud 31 all share types use the consistent permissions attributes, which simplifies code, but caused a regression: Images can no longer been viewed. Because on 30 and before the attribute was not set, previews for view-only files were still allowed. Now with 31 we need a new way to allow "viewing" shares. So this is allowing previews for those files, but only for internal usage. This is done by settin a special header, which only works with custom requests, and not by opening the URL directly. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
* refactor(core): Replace security annotations with respective attributesprovokateurin2024-07-261-6/+6
| | | | Signed-off-by: provokateurin <kate@provokateurin.de>
* fix: Ignore preview requests for invalid file idsJulius Härtl2024-07-221-0/+4
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* chore: Add SPDX headerAndy Scherzinger2024-05-271-21/+2
| | | | Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
* docs(preview): Improve API parameter descriptionsprovokateurin2024-05-131-8/+8
| | | | Signed-off-by: provokateurin <kate@provokateurin.de>
* perf: switch places that always use the first getById result to getFirstNodeByIdRobin Appelman2024-03-041-4/+2
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* refactor(core): Switch to attribute based routingprovokateurin2024-02-211-0/+3
| | | | Signed-off-by: provokateurin <kate@provokateurin.de>
* fix(tests): preview phpunitJohn Molakvoæ2023-08-171-1/+1
| | | | Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
* feat: redirect to the mime icon if no preview availableJohn Molakvoæ2023-08-171-8/+25
| | | | Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
* core: Add OpenAPI specjld31032023-07-131-3/+29
| | | | Signed-off-by: jld3103 <jld3103yt@gmail.com>
* Applies agreed-upon indentation convention to the changed controllers.Faraz Samapoor2023-06-161-5/+7
| | | | | | Based on https://github.com/nextcloud/server/pull/38636#discussion_r1218167753 Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
* Refactors controllers by using PHP8's constructor property promotion.Faraz Samapoor2023-06-161-12/+3
| | | | Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
* Fix type of PreviewController::$userIdVarun Patil2022-11-241-1/+1
| | | | | | Can be null if not logged in; currently crashes Signed-off-by: Varun Patil <varunpatil@ucla.edu>
* Check share attributes on preview endpointsJulius Härtl2022-10-251-0/+11
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Update core to PHP 7.4 standardCarl Schwan2022-05-201-39/+3
| | | | | | | - Typed properties - Port to LoggerInterface Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Improve caching policyCarl Schwan2022-02-161-2/+4
| | | | | | | | | | | | | | * Cache css with version in url. This makes most js and css requests to be cached by the browser * Force caching previews, the etag is in the url so that if the propfind gives a new etag, we will refresh it otherwise it's no use to try to fetch the new etag and do tons of DB queries Tested with firefox and 'debug' => false (important so that the js/css urls are generated with ?v= parameter) Signed-off-by: Carl Schwan <carl@carlschwan.eu>
* Merge pull request #26494 from rigrig/fix-php8-deprecationsMorris Jobke2021-06-071-2/+2
|\ | | | | Fix some php 8 warnings
| * Fix functions taking optional parameters before required onesRichard de Boer2021-05-291-2/+2
| | | | | | | | | | | | | | PHP 8 shows deprecation warnings about this, see #25806 Removes the "default" values, as they actually are required parameters anyway. Signed-off-by: Richard de Boer <git@tubul.net>
* | Update php licensesJohn Molakvoæ (skjnldsv)2021-06-041-2/+1
|/ | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Update license headers for 19Christoph Wurst2020-04-291-0/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-101-4/+0
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-091-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update license headersChristoph Wurst2019-12-051-1/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Some php-cs fixesRoeland Jago Douma2019-11-221-2/+2
| | | | | | | | | | | * Order the imports * No leading slash on imports * Empty line before namespace * One line per import * Empty after imports * Emmpty line at bottom of file Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update PreviewControllerRoeland Jago Douma2019-07-261-6/+1
| | | | | | | | | | | | | The constructor is called with the userId. However if a user is not logged in this is null. Which means that we get an exception instead of this being handled gracefully in the middleware. There are cleaner solutions. But this is the solution that is the easiest to apply without lots of work and risk of breaking things (handling the logged in middleware before initializing the controller etc). Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix usageRoeland Jago Douma2018-06-041-10/+0
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add preview endpoint for the fileidRoeland Jago Douma2018-01-241-14/+75
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update license headersMorris Jobke2017-11-061-0/+1
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Handle more error casesMorris Jobke2017-05-021-0/+2
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add cache 1 day cache to preview endpointRoeland Jago Douma2016-11-031-2/+20
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* More testsRoeland Jago Douma2016-11-031-7/+4
| | | | | | | | | * PreviewController test * PublicPreview test * Versions Preview test * Trash Preview test Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move Ipreview to more of DI thingyRoeland Jago Douma2016-11-031-27/+21
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move fileRoeland Jago Douma2016-11-031-1/+1
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Move preview endpoint to controllerRoeland Jago Douma2016-11-031-0/+123
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>