Skip to content

Commit b14c303

Browse files
committed
Add legacy DAV route for backward compatibility
1 parent 2dc28ae commit b14c303

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/Controller/DAVController.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,20 @@ private function initExceptionListener()
312312
});
313313
}
314314

315+
#[Route('/dav.php/{path?}', name: 'dav-old', requirements: ['path' => '.*'])]
316+
public function davLegacy(Request $request, ?string $path): Response
317+
{
318+
return $this->redirect($this->generateUrl('dav', ['path' => $path ?? '']).$this->buildQueryString($request), 301);
319+
}
320+
321+
private function buildQueryString(Request $request): string
322+
{
323+
$qs = $request->getQueryString();
324+
325+
return $qs ? '?'.$qs : '';
326+
}
327+
315328
#[Route('/dav/{path}', name: 'dav', requirements: ['path' => '.*'])]
316-
#[Route('/dav.php/{path}', name: 'dav-old', requirements: ['path' => '.*'])]
317329
public function dav(Request $request, ?string $path, ?Profiler $profiler = null)
318330
{
319331
// We don't want the toolbar on the /dav/* routes

0 commit comments

Comments
 (0)