Skip to content

Commit

Permalink
feat: disable the toolbar on dav/* routes
Browse files Browse the repository at this point in the history
  • Loading branch information
tchapi committed Jan 20, 2024
1 parent 8fa0cd8 commit 829977e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ services:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

Symfony\Component\HttpKernel\Profiler\Profiler: '@profiler'

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
Expand Down
6 changes: 5 additions & 1 deletion src/Controller/DAVController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Expand Down Expand Up @@ -289,8 +290,11 @@ private function initExceptionListener()
}

#[Route('/dav/{path}', name: 'dav', requirements: ['path' => '.*'])]
public function dav(Request $request, string $path)
public function dav(Request $request, Profiler $profiler, string $path)
{
// We don't want the toolbar on the /dav/* routes
$profiler->disable();

// We need to acknowledge the OPTIONS call before sabre/dav for public
// calendars since we're circumventing the lib
if ('OPTIONS' === $request->getMethod()) {
Expand Down

0 comments on commit 829977e

Please sign in to comment.