We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `litestar/constants.py`
Content:
```
1 from inspect import Signature
2 
3 from pydantic.fields import Undefined
4 
5 from litestar.types import Empty
6 
7 DEFAULT_ALLOWED_CORS_HEADERS = {"Accept", "Accept-Language", "Content-Language", "Content-Type"}
8 DEFAULT_CHUNK_SIZE = 1024 * 128  # 128KB
9 HTTP_DISCONNECT = "http.disconnect"
10 HTTP_RESPONSE_BODY = "http.response.body"
11 HTTP_RESPONSE_START = "http.response.start"
12 ONE_MEGABYTE = 1024 * 1024
13 OPENAPI_NOT_INITIALIZED = "Litestar has not been instantiated with OpenAPIConfig"
14 REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}
15 RESERVED_KWARGS = {"state", "headers", "cookies", "request", "socket", "data", "query", "scope", "body"}
16 SCOPE_STATE_DEPENDENCY_CACHE = "dependency_cache"
17 SCOPE_STATE_NAMESPACE = "__litestar__"
18 SCOPE_STATE_RESPONSE_COMPRESSED = "response_compressed"
19 SKIP_VALIDATION_NAMES = {"request", "socket", "scope", "receive", "send"}
20 UNDEFINED_SENTINELS = {Undefined, Signature.empty, Empty, Ellipsis}
21 WEBSOCKET_CLOSE = "websocket.close"
22 WEBSOCKET_DISCONNECT = "websocket.disconnect"
23
```

Path: `litestar/response/redirect.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import TYPE_CHECKING, Any, Literal
4 from urllib.parse import quote
5 
6 from litestar.constants import REDIRECT_STATUS_CODES
7 from litestar.enums import MediaType
8 from litestar.exceptions import ImproperlyConfiguredException
9 from litestar.response.base import Response
10 from litestar.status_codes import HTTP_307_TEMPORARY_REDIRECT
11 
12 __all__ = ("RedirectResponse",)
13 
14 
15 if TYPE_CHECKING:
16     from litestar.background_tasks import BackgroundTask, BackgroundTasks
17     from litestar.types import ResponseCookies
18 
19 
20 class RedirectResponse(Response[Any]):
21     """A redirect response."""
22 
23     def __init__(
24         self,
25         url: str,
26         *,
27         status_code: Literal[301, 302, 303, 307, 308] = HTTP_307_TEMPORARY_REDIRECT,
28         background: BackgroundTask | BackgroundTasks | None = None,
29         headers: dict[str, Any] | None = None,
30         cookies: ResponseCookies | None = None,
31         encoding: str = "utf-8",
32     ) -> None:
33         """Initialize the response.
34 
35         Args:
36             url: A url to redirect to.
37             status_code: An HTTP status code. The status code should be one of 301, 302, 303, 307 or 308,
38                 otherwise an exception will be raised.
39             background: A background task or tasks to be run after the response is sent.
40             headers: A string keyed dictionary of response headers. Header keys are insensitive.
41             cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response
42                 ``Set-Cookie`` header.
43             encoding: The encoding to be used for the response headers.
44 
45         Raises:
46             ImproperlyConfiguredException: If status code is not a redirect status code.
47         """
48         if status_code not in REDIRECT_STATUS_CODES:
49             raise ImproperlyConfiguredException(
50                 f"{status_code} is not a valid for this response. "
51                 f"Redirect responses should have one of "
52                 f"the following status codes: {', '.join([str(s) for s in REDIRECT_STATUS_CODES])}"
53             )
54         super().__init__(
55             background=background,
56             content=b"",
57             cookies=cookies,
58             headers={**(headers or {}), "location": quote(url, safe="/#%[]=:;$&()+,!?*@'~")},
59             media_type=MediaType.TEXT,
60             status_code=status_code,
61             encoding=encoding,
62         )
63
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/litestar/constants.py b/litestar/constants.py
--- a/litestar/constants.py
+++ b/litestar/constants.py
@@ -2,6 +2,7 @@
 
 from pydantic.fields import Undefined
 
+from litestar.enums import MediaType
 from litestar.types import Empty
 
 DEFAULT_ALLOWED_CORS_HEADERS = {"Accept", "Accept-Language", "Content-Language", "Content-Type"}
@@ -12,6 +13,7 @@
 ONE_MEGABYTE = 1024 * 1024
 OPENAPI_NOT_INITIALIZED = "Litestar has not been instantiated with OpenAPIConfig"
 REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}
+REDIRECT_ALLOWED_MEDIA_TYPES = {MediaType.TEXT, MediaType.HTML}
 RESERVED_KWARGS = {"state", "headers", "cookies", "request", "socket", "data", "query", "scope", "body"}
 SCOPE_STATE_DEPENDENCY_CACHE = "dependency_cache"
 SCOPE_STATE_NAMESPACE = "__litestar__"
diff --git a/litestar/response/redirect.py b/litestar/response/redirect.py
--- a/litestar/response/redirect.py
+++ b/litestar/response/redirect.py
@@ -3,7 +3,7 @@
 from typing import TYPE_CHECKING, Any, Literal
 from urllib.parse import quote
 
-from litestar.constants import REDIRECT_STATUS_CODES
+from litestar.constants import REDIRECT_ALLOWED_MEDIA_TYPES, REDIRECT_STATUS_CODES
 from litestar.enums import MediaType
 from litestar.exceptions import ImproperlyConfiguredException
 from litestar.response.base import Response
@@ -29,6 +29,7 @@
         headers: dict[str, Any] | None = None,
         cookies: ResponseCookies | None = None,
         encoding: str = "utf-8",
+        media_type: str | MediaType = MediaType.TEXT,
     ) -> None:
         """Initialize the response.
 
@@ -41,9 +42,11 @@
             cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response
                 ``Set-Cookie`` header.
             encoding: The encoding to be used for the response headers.
+            media_type: A value for the response ``Content-Type`` header.
+
 
         Raises:
-            ImproperlyConfiguredException: If status code is not a redirect status code.
+            ImproperlyConfiguredException: Either if status code is not a redirect status code or media type is not supported.
         """
         if status_code not in REDIRECT_STATUS_CODES:
             raise ImproperlyConfiguredException(
@@ -51,12 +54,18 @@
                 f"Redirect responses should have one of "
                 f"the following status codes: {', '.join([str(s) for s in REDIRECT_STATUS_CODES])}"
             )
+        if media_type not in REDIRECT_ALLOWED_MEDIA_TYPES:
+            raise ImproperlyConfiguredException(
+                f"{media_type} media type is not supported yet. "
+                f"Media type should be one of "
+                f"the following values: {', '.join([str(s) for s in REDIRECT_ALLOWED_MEDIA_TYPES])}"
+            )
         super().__init__(
             background=background,
             content=b"",
             cookies=cookies,
             headers={**(headers or {}), "location": quote(url, safe="/#%[]=:;$&()+,!?*@'~")},
-            media_type=MediaType.TEXT,
+            media_type=media_type,
             status_code=status_code,
             encoding=encoding,
         )

{"golden_diff": "diff --git a/litestar/constants.py b/litestar/constants.py\n--- a/litestar/constants.py\n+++ b/litestar/constants.py\n@@ -2,6 +2,7 @@\n \n from pydantic.fields import Undefined\n \n+from litestar.enums import MediaType\n from litestar.types import Empty\n \n DEFAULT_ALLOWED_CORS_HEADERS = {\"Accept\", \"Accept-Language\", \"Content-Language\", \"Content-Type\"}\n@@ -12,6 +13,7 @@\n ONE_MEGABYTE = 1024 * 1024\n OPENAPI_NOT_INITIALIZED = \"Litestar has not been instantiated with OpenAPIConfig\"\n REDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}\n+REDIRECT_ALLOWED_MEDIA_TYPES = {MediaType.TEXT, MediaType.HTML}\n RESERVED_KWARGS = {\"state\", \"headers\", \"cookies\", \"request\", \"socket\", \"data\", \"query\", \"scope\", \"body\"}\n SCOPE_STATE_DEPENDENCY_CACHE = \"dependency_cache\"\n SCOPE_STATE_NAMESPACE = \"__litestar__\"\ndiff --git a/litestar/response/redirect.py b/litestar/response/redirect.py\n--- a/litestar/response/redirect.py\n+++ b/litestar/response/redirect.py\n@@ -3,7 +3,7 @@\n from typing import TYPE_CHECKING, Any, Literal\n from urllib.parse import quote\n \n-from litestar.constants import REDIRECT_STATUS_CODES\n+from litestar.constants import REDIRECT_ALLOWED_MEDIA_TYPES, REDIRECT_STATUS_CODES\n from litestar.enums import MediaType\n from litestar.exceptions import ImproperlyConfiguredException\n from litestar.response.base import Response\n@@ -29,6 +29,7 @@\n         headers: dict[str, Any] | None = None,\n         cookies: ResponseCookies | None = None,\n         encoding: str = \"utf-8\",\n+        media_type: str | MediaType = MediaType.TEXT,\n     ) -> None:\n         \"\"\"Initialize the response.\n \n@@ -41,9 +42,11 @@\n             cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response\n                 ``Set-Cookie`` header.\n             encoding: The encoding to be used for the response headers.\n+            media_type: A value for the response ``Content-Type`` header.\n+\n \n         Raises:\n-            ImproperlyConfiguredException: If status code is not a redirect status code.\n+            ImproperlyConfiguredException: Either if status code is not a redirect status code or media type is not supported.\n         \"\"\"\n         if status_code not in REDIRECT_STATUS_CODES:\n             raise ImproperlyConfiguredException(\n@@ -51,12 +54,18 @@\n                 f\"Redirect responses should have one of \"\n                 f\"the following status codes: {', '.join([str(s) for s in REDIRECT_STATUS_CODES])}\"\n             )\n+        if media_type not in REDIRECT_ALLOWED_MEDIA_TYPES:\n+            raise ImproperlyConfiguredException(\n+                f\"{media_type} media type is not supported yet. \"\n+                f\"Media type should be one of \"\n+                f\"the following values: {', '.join([str(s) for s in REDIRECT_ALLOWED_MEDIA_TYPES])}\"\n+            )\n         super().__init__(\n             background=background,\n             content=b\"\",\n             cookies=cookies,\n             headers={**(headers or {}), \"location\": quote(url, safe=\"/#%[]=:;$&()+,!?*@'~\")},\n-            media_type=MediaType.TEXT,\n+            media_type=media_type,\n             status_code=status_code,\n             encoding=encoding,\n         )\n", "issue": "StaticFilesConfig and virtual directories\nI'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. \r\n\r\nThis is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.\r\n\r\nhttps://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32\n", "before_files": [{"content": "from inspect import Signature\n\nfrom pydantic.fields import Undefined\n\nfrom litestar.types import Empty\n\nDEFAULT_ALLOWED_CORS_HEADERS = {\"Accept\", \"Accept-Language\", \"Content-Language\", \"Content-Type\"}\nDEFAULT_CHUNK_SIZE = 1024 * 128  # 128KB\nHTTP_DISCONNECT = \"http.disconnect\"\nHTTP_RESPONSE_BODY = \"http.response.body\"\nHTTP_RESPONSE_START = \"http.response.start\"\nONE_MEGABYTE = 1024 * 1024\nOPENAPI_NOT_INITIALIZED = \"Litestar has not been instantiated with OpenAPIConfig\"\nREDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}\nRESERVED_KWARGS = {\"state\", \"headers\", \"cookies\", \"request\", \"socket\", \"data\", \"query\", \"scope\", \"body\"}\nSCOPE_STATE_DEPENDENCY_CACHE = \"dependency_cache\"\nSCOPE_STATE_NAMESPACE = \"__litestar__\"\nSCOPE_STATE_RESPONSE_COMPRESSED = \"response_compressed\"\nSKIP_VALIDATION_NAMES = {\"request\", \"socket\", \"scope\", \"receive\", \"send\"}\nUNDEFINED_SENTINELS = {Undefined, Signature.empty, Empty, Ellipsis}\nWEBSOCKET_CLOSE = \"websocket.close\"\nWEBSOCKET_DISCONNECT = \"websocket.disconnect\"\n", "path": "litestar/constants.py"}, {"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, Any, Literal\nfrom urllib.parse import quote\n\nfrom litestar.constants import REDIRECT_STATUS_CODES\nfrom litestar.enums import MediaType\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.response.base import Response\nfrom litestar.status_codes import HTTP_307_TEMPORARY_REDIRECT\n\n__all__ = (\"RedirectResponse\",)\n\n\nif TYPE_CHECKING:\n    from litestar.background_tasks import BackgroundTask, BackgroundTasks\n    from litestar.types import ResponseCookies\n\n\nclass RedirectResponse(Response[Any]):\n    \"\"\"A redirect response.\"\"\"\n\n    def __init__(\n        self,\n        url: str,\n        *,\n        status_code: Literal[301, 302, 303, 307, 308] = HTTP_307_TEMPORARY_REDIRECT,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        headers: dict[str, Any] | None = None,\n        cookies: ResponseCookies | None = None,\n        encoding: str = \"utf-8\",\n    ) -> None:\n        \"\"\"Initialize the response.\n\n        Args:\n            url: A url to redirect to.\n            status_code: An HTTP status code. The status code should be one of 301, 302, 303, 307 or 308,\n                otherwise an exception will be raised.\n            background: A background task or tasks to be run after the response is sent.\n            headers: A string keyed dictionary of response headers. Header keys are insensitive.\n            cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response\n                ``Set-Cookie`` header.\n            encoding: The encoding to be used for the response headers.\n\n        Raises:\n            ImproperlyConfiguredException: If status code is not a redirect status code.\n        \"\"\"\n        if status_code not in REDIRECT_STATUS_CODES:\n            raise ImproperlyConfiguredException(\n                f\"{status_code} is not a valid for this response. \"\n                f\"Redirect responses should have one of \"\n                f\"the following status codes: {', '.join([str(s) for s in REDIRECT_STATUS_CODES])}\"\n            )\n        super().__init__(\n            background=background,\n            content=b\"\",\n            cookies=cookies,\n            headers={**(headers or {}), \"location\": quote(url, safe=\"/#%[]=:;$&()+,!?*@'~\")},\n            media_type=MediaType.TEXT,\n            status_code=status_code,\n            encoding=encoding,\n        )\n", "path": "litestar/response/redirect.py"}], "after_files": [{"content": "from inspect import Signature\n\nfrom pydantic.fields import Undefined\n\nfrom litestar.enums import MediaType\nfrom litestar.types import Empty\n\nDEFAULT_ALLOWED_CORS_HEADERS = {\"Accept\", \"Accept-Language\", \"Content-Language\", \"Content-Type\"}\nDEFAULT_CHUNK_SIZE = 1024 * 128  # 128KB\nHTTP_DISCONNECT = \"http.disconnect\"\nHTTP_RESPONSE_BODY = \"http.response.body\"\nHTTP_RESPONSE_START = \"http.response.start\"\nONE_MEGABYTE = 1024 * 1024\nOPENAPI_NOT_INITIALIZED = \"Litestar has not been instantiated with OpenAPIConfig\"\nREDIRECT_STATUS_CODES = {301, 302, 303, 307, 308}\nREDIRECT_ALLOWED_MEDIA_TYPES = {MediaType.TEXT, MediaType.HTML}\nRESERVED_KWARGS = {\"state\", \"headers\", \"cookies\", \"request\", \"socket\", \"data\", \"query\", \"scope\", \"body\"}\nSCOPE_STATE_DEPENDENCY_CACHE = \"dependency_cache\"\nSCOPE_STATE_NAMESPACE = \"__litestar__\"\nSCOPE_STATE_RESPONSE_COMPRESSED = \"response_compressed\"\nSKIP_VALIDATION_NAMES = {\"request\", \"socket\", \"scope\", \"receive\", \"send\"}\nUNDEFINED_SENTINELS = {Undefined, Signature.empty, Empty, Ellipsis}\nWEBSOCKET_CLOSE = \"websocket.close\"\nWEBSOCKET_DISCONNECT = \"websocket.disconnect\"\n", "path": "litestar/constants.py"}, {"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING, Any, Literal\nfrom urllib.parse import quote\n\nfrom litestar.constants import REDIRECT_ALLOWED_MEDIA_TYPES, REDIRECT_STATUS_CODES\nfrom litestar.enums import MediaType\nfrom litestar.exceptions import ImproperlyConfiguredException\nfrom litestar.response.base import Response\nfrom litestar.status_codes import HTTP_307_TEMPORARY_REDIRECT\n\n__all__ = (\"RedirectResponse\",)\n\n\nif TYPE_CHECKING:\n    from litestar.background_tasks import BackgroundTask, BackgroundTasks\n    from litestar.types import ResponseCookies\n\n\nclass RedirectResponse(Response[Any]):\n    \"\"\"A redirect response.\"\"\"\n\n    def __init__(\n        self,\n        url: str,\n        *,\n        status_code: Literal[301, 302, 303, 307, 308] = HTTP_307_TEMPORARY_REDIRECT,\n        background: BackgroundTask | BackgroundTasks | None = None,\n        headers: dict[str, Any] | None = None,\n        cookies: ResponseCookies | None = None,\n        encoding: str = \"utf-8\",\n        media_type: str | MediaType = MediaType.TEXT,\n    ) -> None:\n        \"\"\"Initialize the response.\n\n        Args:\n            url: A url to redirect to.\n            status_code: An HTTP status code. The status code should be one of 301, 302, 303, 307 or 308,\n                otherwise an exception will be raised.\n            background: A background task or tasks to be run after the response is sent.\n            headers: A string keyed dictionary of response headers. Header keys are insensitive.\n            cookies: A list of :class:`Cookie <.datastructures.Cookie>` instances to be set under the response\n                ``Set-Cookie`` header.\n            encoding: The encoding to be used for the response headers.\n            media_type: A value for the response ``Content-Type`` header.\n\n\n        Raises:\n            ImproperlyConfiguredException: Either if status code is not a redirect status code or media type is not supported.\n        \"\"\"\n        if status_code not in REDIRECT_STATUS_CODES:\n            raise ImproperlyConfiguredException(\n                f\"{status_code} is not a valid for this response. \"\n                f\"Redirect responses should have one of \"\n                f\"the following status codes: {', '.join([str(s) for s in REDIRECT_STATUS_CODES])}\"\n            )\n        if media_type not in REDIRECT_ALLOWED_MEDIA_TYPES:\n            raise ImproperlyConfiguredException(\n                f\"{media_type} media type is not supported yet. \"\n                f\"Media type should be one of \"\n                f\"the following values: {', '.join([str(s) for s in REDIRECT_ALLOWED_MEDIA_TYPES])}\"\n            )\n        super().__init__(\n            background=background,\n            content=b\"\",\n            cookies=cookies,\n            headers={**(headers or {}), \"location\": quote(url, safe=\"/#%[]=:;$&()+,!?*@'~\")},\n            media_type=media_type,\n            status_code=status_code,\n            encoding=encoding,\n        )\n", "path": "litestar/response/redirect.py"}]}