Repository: stable-diffusion-webui
Issue: [Bug]: 
Labels: bug-report

### Checklist

- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet

### What happened?

When "Show cards for models in hidden directories" is set to "Never" extended networks no longer works and it returns a "TypeError: string indices must be integers" error.

### Steps to reproduce the problem

Set "Show cards for models in hidden directories" to Never, apply and reload the UI.

### What should have happened?

Hidden directories should be hidden.  They are no longer hidden in 1.8.0 when set to "When Searched".

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

Mozilla Firefox

### Sysinfo

[sysinfo-2024-03-30-22-53.json](https://github.com/AUTOMATIC1111/stable-diffusion-webui/files/14813524/sysinfo-2024-03-30-22-53.json)


### Console logs

```Shell
venv "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
You are up to date with the most recent release.
Launching Web UI with arguments: --port 7860 --skip-python-version-check --update-check --disable-safe-unpickle --ckpt-dir X:\AI\Stable Diffusion\models\Checkpoint --vae-dir X:\AI\Stable Diffusion\models\VAE --esrgan-models-path X:\AI\Stable Diffusion\models\ESRGAN --realesrgan-models-path X:\AI\Stable Diffusion\models\RealESRGAN --lora-dir X:\AI\Stable Diffusion\models\Lora --embeddings-dir X:\AI\Stable Diffusion\embeddings --hypernetwork-dir X:\AI\Stable Diffusion\models\hypernetworks --codeformer-models-path X:\AI\Stable Diffusion\models\Codeformer --gfpgan-models-path X:\AI\Stable Diffusion\models\GFPGAN --bsrgan-models-path X:\AI\Stable Diffusion\models\BSRGAN --swinir-models-path X:\AI\Stable Diffusion\models\SwinIR --ldsr-models-path X:\AI\Stable Diffusion\models\LDSR
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Loading weights [4078eb4174] from X:\AI\Stable Diffusion\models\Checkpoint\3Guofeng3_v33.safetensors
Creating model from config: D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\configs\v1-inference.yaml
Applying attention optimization: Doggettx... done.
Model loaded in 61.5s (load weights from disk: 1.1s, create model: 0.3s, apply weights to model: 58.0s, apply dtype to VAE: 0.2s, load textual inversion embeddings: 1.5s, calculate empty prompt: 0.2s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 130.7s (prepare environment: 3.1s, import torch: 5.2s, import gradio: 1.0s, setup paths: 1.2s, initialize shared: 0.3s, other imports: 0.8s, list SD models: 38.1s, load scripts: 7.1s, refresh VAE: 1.6s, create ui: 72.1s, gradio launch: 0.1s).
Traceback (most recent call last):
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 703, in pages_html
    create_html()
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 699, in create_html
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 699, in <listcomp>
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 547, in create_html
    "tree_html": self.create_tree_view_html(tabname),
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 472, in create_tree_view_html
    item_html = self.create_tree_dir_item_html(tabname, k, _build_tree(v))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 465, in _build_tree
    _dir_li.append(self.create_tree_dir_item_html(tabname, k, _build_tree(v)))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 463, in _build_tree
    _file_li.append(self.create_tree_file_item_html(tabname, k, v.item))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 395, in create_tree_file_item_html
    item_html_args["copy_path_button"],
TypeError: string indices must be integers
Traceback (most recent call last):
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 703, in pages_html
    create_html()
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 699, in create_html
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 699, in <listcomp>
    ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 547, in create_html
    "tree_html": self.create_tree_view_html(tabname),
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 472, in create_tree_view_html
    item_html = self.create_tree_dir_item_html(tabname, k, _build_tree(v))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 465, in _build_tree
    _dir_li.append(self.create_tree_dir_item_html(tabname, k, _build_tree(v)))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 463, in _build_tree
    _file_li.append(self.create_tree_file_item_html(tabname, k, v.item))
  File "D:\Stable Diffusion\stable-diffusion-1.8.0\stable-diffusion-webui\modules\ui_extra_networks.py", line 395, in create_tree_file_item_html
    item_html_args["copy_path_button"],
TypeError: string indices must be integers
```


### Additional information

_No response_