You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> The public directory (served at `/dav/public`) is readable by every authenticated user. By default only users flagged as admins in the dashboard can create, modify or delete files in it; set `WEBDAV_PUBLIC_DIR_WRITABLE=true` to let every authenticated user write to it. Directories must be absolute paths and must not live inside the web root.
204
+
200
205
> [!NOTE]
201
206
>
202
207
> In a docker setup, I recommend setting `WEBDAV_TMP_DIR` to `/tmp`.
thrownew \RuntimeException(sprintf('%s must be an absolute path, "%s" given.', $envVar, $dir));
331
+
}
332
+
333
+
$realDir = realpath($dir);
334
+
if (false === $realDir || !is_dir($realDir)) {
335
+
thrownew \RuntimeException(sprintf('%s points to "%s", which does not exist or is not a directory. Make sure it is created with the correct permissions.', $envVar, $dir));
thrownew \RuntimeException(sprintf('%s ("%s") must not be inside the web root ("%s"): the web server would serve these files without any permission check.', $envVar, $dir, $webRoot));
297
341
}
298
342
}
299
343
@@ -365,38 +409,38 @@ public function dav(Request $request, ?string $path, ?Profiler $profiler = null)
365
409
return$response;
366
410
}
367
411
368
-
// \Sabre\DAV\Server does not let us use a custom SAPI, and its behaviour
369
-
// is to directly output headers and content to php://output. Hence, we
370
-
// let the headers pass (we have not choice) and capture the output in a
371
-
// buffer.
372
-
// This allows us to use a Response, and not to break the events triggered
373
-
// by Symfony after the response is sent, like for instance the TERMINATE
374
-
// event from the Kernel, that is used to send emails...
375
-
412
+
// \Sabre\DAV\Server does not let us use a custom SAPI: it writes its status line and
413
+
// headers with header() and streams the body to php://output. We capture the output
414
+
// so that we can hand a proper Response back to Symfony (and keep its kernel events,
415
+
// like TERMINATE, working).
376
416
ob_start(); // Does not capture headers!
377
417
$this->server->start();
378
-
379
-
$output = ob_get_contents();
380
-
ob_end_clean();
381
-
382
-
// As previously said, headers are already _prepared_ by the server,
383
-
// so we can't modify them or remove them. But they are not _sent_ yet,
384
-
// so headers_sent() is false, and Symfony will add its own headers above it.
385
-
//
386
-
// The Content-type header is the problem, since Symfony will
387
-
// output `text/html` for everything since it doesn't know any better.
388
-
// Thus, we have to get the _real_ Content-type header already prepared,
0 commit comments