diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-08-06 17:45:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 17:45:44 +0200 |
commit | 42650f6773e14bdf6102fe3187d2521e5bf0f4a6 (patch) | |
tree | f8f9540352c588d2b45469b23d76fb8cfc02803d /lib/private | |
parent | e6457aa9c44f7eb19cfc54e1ac9473110a614947 (diff) | |
parent | db28aa8cd14d40a671396778a06af10879b5d14a (diff) | |
download | nextcloud-server-42650f6773e14bdf6102fe3187d2521e5bf0f4a6.tar.gz nextcloud-server-42650f6773e14bdf6102fe3187d2521e5bf0f4a6.zip |
Merge pull request #46967 from nextcloud/fix/share-not-found
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AppFramework/DependencyInjection/DIContainer.php | 2 | ||||
-rw-r--r-- | lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php | 30 |
2 files changed, 13 insertions, 19 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 81365900d9b..208031b942f 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -288,7 +288,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { new OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware( $c->get(IRequest::class), $c->get(ISession::class), - $c->get(\OCP\IConfig::class), + $c->get(IConfig::class), $c->get(IThrottler::class) ) ); diff --git a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php index 41cba1aacd3..34291dfef10 100644 --- a/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php +++ b/lib/private/AppFramework/Middleware/PublicShare/PublicShareMiddleware.php @@ -6,8 +6,10 @@ namespace OC\AppFramework\Middleware\PublicShare; use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationException; +use OCA\Files_Sharing\AppInfo\Application; use OCP\AppFramework\AuthPublicShareController; -use OCP\AppFramework\Http\NotFoundResponse; +use OCP\AppFramework\Http; +use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Middleware; use OCP\AppFramework\PublicShareController; use OCP\Files\NotFoundException; @@ -17,23 +19,13 @@ use OCP\ISession; use OCP\Security\Bruteforce\IThrottler; class PublicShareMiddleware extends Middleware { - /** @var IRequest */ - private $request; - /** @var ISession */ - private $session; - - /** @var IConfig */ - private $config; - - /** @var IThrottler */ - private $throttler; - - public function __construct(IRequest $request, ISession $session, IConfig $config, IThrottler $throttler) { - $this->request = $request; - $this->session = $session; - $this->config = $config; - $this->throttler = $throttler; + public function __construct( + private IRequest $request, + private ISession $session, + private IConfig $config, + private IThrottler $throttler + ) { } public function beforeController($controller, $methodName) { @@ -92,7 +84,9 @@ class PublicShareMiddleware extends Middleware { } if ($exception instanceof NotFoundException) { - return new NotFoundResponse(); + return new TemplateResponse(Application::APP_ID, 'sharenotfound', [ + 'message' => $exception->getMessage(), + ], 'guest', Http::STATUS_NOT_FOUND); } if ($controller instanceof AuthPublicShareController && $exception instanceof NeedAuthenticationException) { |