Commit Graph

138 Commits (jtr/fix-public-exceptions-http-codes)

Author SHA1 Message Date
Carl Schwan 336cc3fa35 feat(Db): Use SnowflakeId for previews
Allow to get an id for the storing the preview on disk before inserting
the preview on the DB.

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-28 17:50:03 +07:00
Thomas Citharel 7bf8e9699c
fix(http): handle getHttpProtocol being unset in $_SERVER['SERVER_PROTOCOL'] if called from occ
Due to the profiler app loading HttpDataCollector when running occ.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2025-09-21 18:06:33 +07:00
provokateurin 9473f47c0d fix(Dispatcher): Catch TypeErrors and turn them into bad request responses
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-09-05 00:49:23 +07:00
provokateurin aab11d35d3
fix(OCS): Add IRequest::getFormat to determine the response Content-Type the same way everywhere
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-08-26 09:50:03 +07:00
John Molakvoæ 4829ac57c1 fix: use `OCP\Server`
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2025-08-01 17:00:09 +07:00
Josh 14b4d0327e fix(AppFramework): Log malformed protocol values and unify fallback behavior
Signed-off-by: Josh <josh.t.richards@gmail.com>
2025-08-01 17:00:09 +07:00
Côme Chilliet 9913bdda90
chore: Cleanup DIContainer class
Also removed deprecated tag from the class as this class will not be
 removed, only the interface IAppContainer and associated methods should
 be removed.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-08 13:32:12 +07:00
Côme Chilliet 79f4e0de76
fix: Only attempt to decode JSON input if it is not an empty string
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-01 11:24:27 +07:00
Côme Chilliet e8bc35ec0a
fix(ocs): Return a proper error on JSON decoding failures
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-01 10:45:31 +07:00
Côme Chilliet 87f98c88ab
chore: Rename property and type it to match its current use in Request
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-01 10:25:14 +07:00
Josh 6951053c90
docs(dispatcher): Correct described return values
Signed-off-by: Josh <josh.t.richards@gmail.com>
2025-04-23 22:43:03 +07:00
Joas Schilling 1909b981a4
fix(controller): Fix false booleans in multipart/form-data
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-11-28 12:18:30 +07:00
provokateurin dd0ed02b91
feat(Dispatcher): Add debug log for controller methods returning raw data not wrapped in Response
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-11-15 10:09:59 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Ferdinand Thiessen c82b17d0a3
fix: Support Safari mobile
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-21 13:01:23 +07:00
provokateurin 9d1705259c
fix(AppFramework): Allow requests with OCS-APIRequest header to pass CSRF checks
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-07-25 17:31:49 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Côme Chilliet 672923f0a6
fix: Fix newly spotted psalm issues, add exhaustive typed magic properties for LDAP classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-30 09:23:58 +07:00
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +07:00
Julius Härtl b8c5bff673
fix: Adjust user agent pattern for Edge
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-03-08 12:11:46 +07:00
Joas Schilling 696ed4a125
fix(CS): Fix coding style
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-02-14 15:38:15 +07:00
Joas Schilling c4684089a8
fix(request): Fix regex handling and coding-style
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-02-13 16:51:13 +07:00
Mikael Peigney ffcadf25d4
fix(request): Handle reverse proxy setting a port in Forwarded-For
Signed-off-by: Mikael Peigney <Mika56@users.noreply.github.com>
2024-02-13 16:51:13 +07:00
Côme Chilliet f73f966c98 chore: Add missing ArrayAccess template parameters
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-02-06 10:24:41 +07:00
Ferdinand Thiessen 85978593fe
Merge pull request #42794 from nextcloud/fix/invalid-trusted-proxies
fix(Request): Catch exceptions in `isTrustedProxy`
2024-01-29 16:19:51 +07:00
Pavel Kryl 30ad530814 code style: ommited space, reverted [code review] 2024-01-27 15:11:26 +07:00
Pavel Kryl 446ecbc454 fixing bug #6914: Config Param 'overwritecondaddr' not working
- just ignoring/removing extra parameter 'protocol' as suggested by
  blizzz

Signed-off-by: Pavel Kryl <pavel@kryl.eu>
2024-01-27 15:11:26 +07:00
Ferdinand Thiessen 7620d230df
fix(Request): Catch exceptions in `isTrustedProxy`
The function fails if the configured trusted proxies contain invalid characters and the underlying IpUtils will throw.
But as it is used by `getRemoteAddress` which is used by logging / templating, thrown errors are not reported but silently fail with error 500.

Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-01-27 14:59:51 +07:00
Joas Schilling f6b6776c93
fix(API): Use a distinct exception so apps can react to it and customize the return
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-11-28 06:11:57 +07:00
Arthur Schiwon 3fa43a529b
enh(dispatcher): enforce psalm ranges in the http dispatcher
- allows devs to provide int ranges for API arguments

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-11-24 12:46:38 +07:00
Joas Schilling aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +07:00
Joas Schilling 2fa78f6245
Reverse X-Forwarded-For list to read the correct proxy remote address
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-11-16 07:45:19 +07:00
Hamid Dehnavi ea06cf2f39 Convert isset ternary to null coalescing operator
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-09-28 17:44:19 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Côme Chilliet 426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 12:50:08 +07:00
Julius Härtl dc3916e27c
fix: Only get params from PUT content if possible
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-02-03 22:30:04 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Christoph Wurst 20fcfb5739
feat(app framework)!: Inject services into controller methods
Usually Nextcloud DI goes through constructor injection. This has the
implication that each instance of a class builds the full DI tree. That
is the injected services, their services, etc. Occasionally there is a
service that is only needed for one controller method. Then the DI tree
is build regardless if used or not.

If services are injected into the method, we only build the DI tree if
that method gets executed.

This is also how Laravel allows injection.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-01-18 14:00:38 +07:00
Joas Schilling 0af4e9d4fe
Merge pull request #34172 from audriga/add-scim-json-support
Add support for application/scim+json
2022-12-20 08:58:33 +07:00
Côme Chilliet cf508c1e47 Use strict typing in base.php
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-12-19 09:10:40 +07:00
Stanimir Bozhilov 7dcd6eb561
Merge branch 'master' into add-scim-json-support
Signed-off-by: Stanimir Bozhilov <stanimir.bozhilov.1998@gmail.com>
2022-12-19 09:07:38 +07:00
Vincent Petry ae6fe874ed
Merge pull request #35780 from nextcloud/fix/http-dispatcher-double-parameter-cast
Fix missing cast of double controller parameters
2022-12-16 16:18:35 +07:00
Christoph Wurst b6dd1a1d7b
fix(app framework): Fix missing cast of double controller parameters
``settype`` allows 'double' as alias of 'float'.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2022-12-15 09:33:52 +07:00
Artur Neumann 81f2857f34
check if params given to API are really an array
Signed-off-by: Artur Neumann <artur@jankaritech.com>
2022-12-15 13:45:22 +07:00
Stanimir Bozhilov b44befa881 Move JSON content type regex to IRequest and make it a const 2022-12-08 15:11:23 +07:00
Stanimir Bozhilov 46c10c77e1 Fix the JSON content type regex to match all MIME types
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
2022-09-26 11:51:44 +07:00
Stanimir Bozhilov d80f8f6c82 Type hint JSON content type regex and use preg_match less
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
2022-09-22 11:25:39 +07:00
Stanimir Bozhilov f286a9d6ac Use regex for all JSON-related content types
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
2022-09-21 16:36:01 +07:00
Stanimir Bozhilov 0ace70488a Treat application/json and application/scim+json in same if-block
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
2022-09-21 15:31:50 +07:00