We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Bug]: thumbnail cards are not loading the preview image
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

just getting black image, and if I try to update an image, it goes black too.

It was working before checkpoints were added, I don't know if that's related.

### Steps to reproduce the problem

1. Go to .... 
2. Press ....
3. ...


### What should have happened?

should see the preview images

### Commit where the problem happens

0a8515085ef258d4b76fdc000f7ed9d55751d6b8

### What platforms do you use to access the UI ?

_No response_

### What browsers do you use to access the UI ?

_No response_

### Command Line Arguments

```Shell
--api --cors-allow-origins http://localhost:5173 --administrator --no-half-vae --no-half --disable-safe-unpickle --force-cpu --xformers
```


### List of extensions

all of them

### Console logs

```Shell
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 94, in receive
    return self.receive_nowait()
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 89, in receive_nowait
    raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 77, in call_next
    message = await recv_stream.receive()
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py", line 114, in receive
    raise EndOfStream
anyio.EndOfStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "D:\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 270, in __call__
    await super().__call__(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 106, in __call__
    response = await self.dispatch_func(request, call_next)
  File "D:\stable-diffusion-webui\extensions\auto-sd-paint-ext\backend\app.py", line 391, in app_encryption_middleware
    res: StreamingResponse = await call_next(req)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next
    raise app_exc
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 106, in __call__
    response = await self.dispatch_func(request, call_next)
  File "D:\stable-diffusion-webui\modules\api\api.py", line 96, in log_and_time
    res: Response = await call_next(req)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 80, in call_next
    raise app_exc
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 24, in __call__
    await responder(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 43, in __call__
    await self.app(scope, receive, self.send_with_gzip)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "D:\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 706, in __call__
    await route.handle(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 235, in app
    raw_response = await run_endpoint_function(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
    return await run_in_threadpool(dependant.call, **values)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\stable-diffusion-webui\modules\ui_extra_networks.py", line 28, in fetch_file
    if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):
  File "D:\stable-diffusion-webui\modules\ui_extra_networks.py", line 28, in <listcomp>
    if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):
  File "D:\Python\Python310\lib\pathlib.py", line 960, in __new__
    self = cls._from_parts(args)
  File "D:\Python\Python310\lib\pathlib.py", line 594, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "D:\Python\Python310\lib\pathlib.py", line 578, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```


### Additional information

_No response_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `modules/ui_extra_networks_checkpoints.py`
Content:
```
1 import html
2 import json
3 import os
4 import urllib.parse
5 
6 from modules import shared, ui_extra_networks, sd_models
7 
8 
9 class ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):
10     def __init__(self):
11         super().__init__('Checkpoints')
12 
13     def refresh(self):
14         shared.refresh_checkpoints()
15 
16     def list_items(self):
17         for name, checkpoint in sd_models.checkpoints_list.items():
18             path, ext = os.path.splitext(checkpoint.filename)
19             previews = [path + ".png", path + ".preview.png"]
20 
21             preview = None
22             for file in previews:
23                 if os.path.isfile(file):
24                     preview = self.link_preview(file)
25                     break
26 
27             yield {
28                 "name": checkpoint.name_for_extra,
29                 "filename": path,
30                 "preview": preview,
31                 "search_term": self.search_terms_from_path(checkpoint.filename),
32                 "onclick": '"' + html.escape(f"""return selectCheckpoint({json.dumps(name)})""") + '"',
33                 "local_preview": path + ".png",
34             }
35 
36     def allowed_directories_for_previews(self):
37         return [shared.cmd_opts.ckpt_dir, sd_models.model_path]
38 
39
```
--- 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/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py
--- a/modules/ui_extra_networks_checkpoints.py
+++ b/modules/ui_extra_networks_checkpoints.py
@@ -34,5 +34,5 @@
             }
 
     def allowed_directories_for_previews(self):
-        return [shared.cmd_opts.ckpt_dir, sd_models.model_path]
+        return [v for v in [shared.cmd_opts.ckpt_dir, sd_models.model_path] if v is not None]

{"golden_diff": "diff --git a/modules/ui_extra_networks_checkpoints.py b/modules/ui_extra_networks_checkpoints.py\n--- a/modules/ui_extra_networks_checkpoints.py\n+++ b/modules/ui_extra_networks_checkpoints.py\n@@ -34,5 +34,5 @@\n             }\r\n \r\n     def allowed_directories_for_previews(self):\r\n-        return [shared.cmd_opts.ckpt_dir, sd_models.model_path]\r\n+        return [v for v in [shared.cmd_opts.ckpt_dir, sd_models.model_path] if v is not None]\n", "issue": "[Bug]: thumbnail cards are not loading the preview image\n### Is there an existing issue for this?\n\n- [X] I have searched the existing issues and checked the recent builds/commits\n\n### What happened?\n\njust getting black image, and if I try to update an image, it goes black too.\r\n\r\nIt was working before checkpoints were added, I don't know if that's related.\n\n### Steps to reproduce the problem\n\n1. Go to .... \r\n2. Press ....\r\n3. ...\r\n\n\n### What should have happened?\n\nshould see the preview images\n\n### Commit where the problem happens\n\n0a8515085ef258d4b76fdc000f7ed9d55751d6b8\n\n### What platforms do you use to access the UI ?\n\n_No response_\n\n### What browsers do you use to access the UI ?\n\n_No response_\n\n### Command Line Arguments\n\n```Shell\n--api --cors-allow-origins http://localhost:5173 --administrator --no-half-vae --no-half --disable-safe-unpickle --force-cpu --xformers\n```\n\n\n### List of extensions\n\nall of them\n\n### Console logs\n\n```Shell\nERROR:    Exception in ASGI application\r\nTraceback (most recent call last):\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\streams\\memory.py\", line 94, in receive\r\n    return self.receive_nowait()\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\streams\\memory.py\", line 89, in receive_nowait\r\n    raise WouldBlock\r\nanyio.WouldBlock\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 77, in call_next\r\n    message = await recv_stream.receive()\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\streams\\memory.py\", line 114, in receive\r\n    raise EndOfStream\r\nanyio.EndOfStream\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\uvicorn\\protocols\\http\\h11_impl.py\", line 407, in run_asgi\r\n    result = await app(  # type: ignore[func-returns-value]\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\uvicorn\\middleware\\proxy_headers.py\", line 78, in __call__\r\n    return await self.app(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\fastapi\\applications.py\", line 270, in __call__\r\n    await super().__call__(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\applications.py\", line 124, in __call__\r\n    await self.middleware_stack(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\errors.py\", line 184, in __call__\r\n    raise exc\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\errors.py\", line 162, in __call__\r\n    await self.app(scope, receive, _send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 106, in __call__\r\n    response = await self.dispatch_func(request, call_next)\r\n  File \"D:\\stable-diffusion-webui\\extensions\\auto-sd-paint-ext\\backend\\app.py\", line 391, in app_encryption_middleware\r\n    res: StreamingResponse = await call_next(req)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 80, in call_next\r\n    raise app_exc\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 69, in coro\r\n    await self.app(scope, receive_or_disconnect, send_no_error)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 106, in __call__\r\n    response = await self.dispatch_func(request, call_next)\r\n  File \"D:\\stable-diffusion-webui\\modules\\api\\api.py\", line 96, in log_and_time\r\n    res: Response = await call_next(req)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 80, in call_next\r\n    raise app_exc\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\base.py\", line 69, in coro\r\n    await self.app(scope, receive_or_disconnect, send_no_error)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\gzip.py\", line 24, in __call__\r\n    await responder(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\gzip.py\", line 43, in __call__\r\n    await self.app(scope, receive, self.send_with_gzip)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\cors.py\", line 84, in __call__\r\n    await self.app(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\exceptions.py\", line 79, in __call__\r\n    raise exc\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\middleware\\exceptions.py\", line 68, in __call__\r\n    await self.app(scope, receive, sender)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\fastapi\\middleware\\asyncexitstack.py\", line 21, in __call__\r\n    raise e\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\fastapi\\middleware\\asyncexitstack.py\", line 18, in __call__\r\n    await self.app(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\routing.py\", line 706, in __call__\r\n    await route.handle(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\routing.py\", line 276, in handle\r\n    await self.app(scope, receive, send)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\routing.py\", line 66, in app\r\n    response = await func(request)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\fastapi\\routing.py\", line 235, in app\r\n    raw_response = await run_endpoint_function(\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\fastapi\\routing.py\", line 163, in run_endpoint_function\r\n    return await run_in_threadpool(dependant.call, **values)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\starlette\\concurrency.py\", line 41, in run_in_threadpool\r\n    return await anyio.to_thread.run_sync(func, *args)\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\to_thread.py\", line 31, in run_sync\r\n    return await get_asynclib().run_sync_in_worker_thread(\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\_backends\\_asyncio.py\", line 937, in run_sync_in_worker_thread\r\n    return await future\r\n  File \"D:\\stable-diffusion-webui\\venv\\lib\\site-packages\\anyio\\_backends\\_asyncio.py\", line 867, in run\r\n    result = context.run(func, *args)\r\n  File \"D:\\stable-diffusion-webui\\modules\\ui_extra_networks.py\", line 28, in fetch_file\r\n    if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):\r\n  File \"D:\\stable-diffusion-webui\\modules\\ui_extra_networks.py\", line 28, in <listcomp>\r\n    if not any([Path(x).resolve() in Path(filename).resolve().parents for x in allowed_dirs]):\r\n  File \"D:\\Python\\Python310\\lib\\pathlib.py\", line 960, in __new__\r\n    self = cls._from_parts(args)\r\n  File \"D:\\Python\\Python310\\lib\\pathlib.py\", line 594, in _from_parts\r\n    drv, root, parts = self._parse_args(args)\r\n  File \"D:\\Python\\Python310\\lib\\pathlib.py\", line 578, in _parse_args\r\n    a = os.fspath(a)\r\nTypeError: expected str, bytes or os.PathLike object, not NoneType\n```\n\n\n### Additional information\n\n_No response_\n", "before_files": [{"content": "import html\r\nimport json\r\nimport os\r\nimport urllib.parse\r\n\r\nfrom modules import shared, ui_extra_networks, sd_models\r\n\r\n\r\nclass ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):\r\n    def __init__(self):\r\n        super().__init__('Checkpoints')\r\n\r\n    def refresh(self):\r\n        shared.refresh_checkpoints()\r\n\r\n    def list_items(self):\r\n        for name, checkpoint in sd_models.checkpoints_list.items():\r\n            path, ext = os.path.splitext(checkpoint.filename)\r\n            previews = [path + \".png\", path + \".preview.png\"]\r\n\r\n            preview = None\r\n            for file in previews:\r\n                if os.path.isfile(file):\r\n                    preview = self.link_preview(file)\r\n                    break\r\n\r\n            yield {\r\n                \"name\": checkpoint.name_for_extra,\r\n                \"filename\": path,\r\n                \"preview\": preview,\r\n                \"search_term\": self.search_terms_from_path(checkpoint.filename),\r\n                \"onclick\": '\"' + html.escape(f\"\"\"return selectCheckpoint({json.dumps(name)})\"\"\") + '\"',\r\n                \"local_preview\": path + \".png\",\r\n            }\r\n\r\n    def allowed_directories_for_previews(self):\r\n        return [shared.cmd_opts.ckpt_dir, sd_models.model_path]\r\n\r\n", "path": "modules/ui_extra_networks_checkpoints.py"}], "after_files": [{"content": "import html\r\nimport json\r\nimport os\r\nimport urllib.parse\r\n\r\nfrom modules import shared, ui_extra_networks, sd_models\r\n\r\n\r\nclass ExtraNetworksPageCheckpoints(ui_extra_networks.ExtraNetworksPage):\r\n    def __init__(self):\r\n        super().__init__('Checkpoints')\r\n\r\n    def refresh(self):\r\n        shared.refresh_checkpoints()\r\n\r\n    def list_items(self):\r\n        for name, checkpoint1 in sd_models.checkpoints_list.items():\r\n            checkpoint: sd_models.CheckpointInfo = checkpoint1\r\n            path, ext = os.path.splitext(checkpoint.filename)\r\n            previews = [path + \".png\", path + \".preview.png\"]\r\n\r\n            preview = None\r\n            for file in previews:\r\n                if os.path.isfile(file):\r\n                    preview = self.link_preview(file)\r\n                    break\r\n\r\n            yield {\r\n                \"name\": checkpoint.model_name,\r\n                \"filename\": path,\r\n                \"preview\": preview,\r\n                \"onclick\": '\"' + html.escape(f\"\"\"return selectCheckpoint({json.dumps(name)})\"\"\") + '\"',\r\n                \"local_preview\": path + \".png\",\r\n            }\r\n\r\n    def allowed_directories_for_previews(self):\r\n        return [v for v in [shared.cmd_opts.ckpt_dir, sd_models.model_path] if v is not None]\r\n\r\n", "path": "modules/ui_extra_networks_checkpoints.py"}]}