Repository: AUTOMATIC1111/stable-diffusion-webui

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_


Discussion:
Same here. My thumbnails are all borked since this last update an hour ago. Empty.
This is the last working commit for thumbnails: 91c8d0dcfc9a5d46aec47fd3eb34c633c104b5bb
The same issue, I started having the same issue when the ui_extra_networks was added with SD-Model-Preview Extension. 
Same here, it just cycle spews the "ERROR:    Exception in ASGI application". No thumbnail gets loaded.
I think it is throwing one error for each, but can't really tell because it went over my console buffer limit.
If I try to "replace preview" a thumbnail it throws:

Traceback (most recent call last):
  File "d:\WORK\conda_envs\automatic\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict
    output = await app.get_blocks().process_api(
  File "d:\WORK\conda_envs\automatic\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(
  File "d:\WORK\conda_envs\automatic\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "d:\WORK\conda_envs\automatic\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:\WORK\conda_envs\automatic\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "d:\WORK\conda_envs\automatic\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "D:\WORK\conda_envs\automatic\stable-diffusion-webui\modules\ui_extra_networks.py", line 192, in save_preview
    if any([path_is_parent(x, filename) for x in extra_page.allowed_directories_for_previews()]):
  File "D:\WORK\conda_envs\automatic\stable-diffusion-webui\modules\ui_extra_networks.py", line 192, in <listcomp>
    if any([path_is_parent(x, filename) for x in extra_page.allowed_directories_for_previews()]):
  File "D:\WORK\conda_envs\automatic\stable-diffusion-webui\modules\ui_extra_networks.py", line 171, in path_is_parent
    parent_path = os.path.abspath(parent_path)
  File "C:\Users\Utilizador\.conda\envs\automatic\lib\ntpath.py", line 566, in abspath
    return normpath(_getfullpathname(path))
TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType
Same here. My thumbnails are all borked since this last update an hour ago. Empty too
![Screenshot 2023-01-29 183424](https://user-images.githubusercontent.com/1563909/215307168-5db32677-3c12-472e-8a8d-af31feb77bdb.png)
Same here
Ya'll can get thumbs back if you roll the head back till you see
`91c8d0d Merge pull request #7231 from EllangoK/master`

For me I rolled back twice

this roll back didn't get thumbs:
```powershell
shane in stable-diffusion-webui in master
git reset HEAD~1 --hard
HEAD is now at 1d8e06d add checkpoints tab for extra networks UI
```

So rolled back once more to this:
```powershell
shane in stable-diffusion-webui in master
git reset HEAD~1 --hard
HEAD is now at 91c8d0d Merge pull request #7231 from EllangoK/master
```

![image](https://user-images.githubusercontent.com/1563909/215307901-a3b24084-ca6e-4a9f-b50f-f23449523770.png)


Resolving patch:
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 list_items(self):
             }
 
     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]
 


Test patch: