Fixed a Time-of-Check Time-of-Use (TOCTOU) bug by handling exceptions instead of checking for a file existing beforehand. While this is extremely unlikely to occur naturally we should fix it anyway.
load_json_config was only being used by the migration, so we can remove it.
We previously saved the loaded config in the data variable. This has a global scope and would not get removed by the gc. We can fix this by moving the migration into its own function.
Future
We should probably add a comment on how long of a migration period we want to have. This project moves very fast and the migration started 7 months ago already.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/11160
**Author:** [@tidely](https://github.com/tidely)
**Created:** 3/4/2025
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `configmigrate`
---
### 📝 Commits (3)
- [`3e8a115`](https://github.com/open-webui/open-webui/commit/3e8a11555e6f80bcf72dd1dd1cfa971cd086bb90) chore: improve config.json migration
- [`f5422ec`](https://github.com/open-webui/open-webui/commit/f5422ecca9f2c73bf368454156bfe1217749fa79) chore: remove unused imports
- [`ce70139`](https://github.com/open-webui/open-webui/commit/ce701393bdc65988def16b699e4a75683f6b533a) Revert "chore: remove unused imports"
### 📊 Changes
**1 file changed** (+13 additions, -10 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/config.py` (+13 -10)
</details>
### 📄 Description
# Description
Fixed a Time-of-Check Time-of-Use (TOCTOU) bug by handling exceptions instead of checking for a file existing beforehand. While this is extremely unlikely to occur naturally we should fix it anyway.
`load_json_config` was only being used by the migration, so we can remove it.
We previously saved the loaded config in the `data` variable. This has a global scope and would not get removed by the gc. We can fix this by moving the migration into its own function.
## Future
We should probably add a comment on how long of a migration period we want to have. This project moves very fast and the migration started 7 months ago already.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/11160
Author: @tidely
Created: 3/4/2025
Status: ❌ Closed
Base:
dev← Head:configmigrate📝 Commits (3)
3e8a115chore: improve config.json migrationf5422ecchore: remove unused importsce70139Revert "chore: remove unused imports"📊 Changes
1 file changed (+13 additions, -10 deletions)
View changed files
📝
backend/open_webui/config.py(+13 -10)📄 Description
Description
Fixed a Time-of-Check Time-of-Use (TOCTOU) bug by handling exceptions instead of checking for a file existing beforehand. While this is extremely unlikely to occur naturally we should fix it anyway.
load_json_configwas only being used by the migration, so we can remove it.We previously saved the loaded config in the
datavariable. This has a global scope and would not get removed by the gc. We can fix this by moving the migration into its own function.Future
We should probably add a comment on how long of a migration period we want to have. This project moves very fast and the migration started 7 months ago already.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.