open-webui/backend/open_webui
Asish Kumar 67a7e0b1d1
fix: drop dangling folder references when importing chats
Chat exports serialize each chat's `folder_id`, but the export does not
include the folders themselves. When such an export is imported into a
different instance (or the same instance after the folders were deleted),
those `folder_id` values point at folders that no longer exist for the
importing user.

`POST /api/v1/chats/import` stored the values verbatim. Because the chat
list query filters out every chat with a non-null `folder_id` (and there
is no matching folder to surface them from), the imported chats became
invisible even though the import reported success.

Sanitize folder references on import: keep folder_ids the user actually
owns (so re-importing on the same instance restores the original
grouping) and reset unknown ones to NULL so the chats land in the main
chat list. This mirrors the existing folder validation in
`POST /api/v1/chats/new` and leaves the clone endpoints, which pass an
already-owned folder_id, unaffected.

Closes #24910
2026-05-25 08:42:47 +05:30
..
data refac: mv backend files to /open_webui dir 2024-09-04 16:54:48 +02:00
internal refac 2026-05-21 16:25:25 +04:00
migrations refac 2026-05-21 15:29:49 +04:00
models refac 2026-05-21 17:48:28 +04:00
retrieval refac 2026-05-21 16:44:36 +04:00
routers fix: drop dangling folder references when importing chats 2026-05-25 08:42:47 +05:30
socket fix: resolve NameError for redis_sentinels in session_cleanup_lock 2026-05-21 13:41:21 +04:00
static refac 2026-05-12 03:04:35 +09:00
storage refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
tools refac 2026-05-21 16:44:36 +04:00
utils refac: clean up Redis sentinel utilities and import grouping 2026-05-21 11:47:25 +04:00
__init__.py refac 2026-05-09 02:38:08 +09:00
alembic.ini fix: Alembic CLI commands from failing 2025-08-15 04:17:47 -04:00
config.py refac 2026-05-21 16:56:56 +04:00
constants.py refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00
env.py refac 2026-05-20 00:22:27 +04:00
functions.py fix: emit [DONE] for AsyncGenerator pipe returns (#24763) 2026-05-19 22:07:56 +04:00
main.py refac 2026-05-21 16:56:56 +04:00
tasks.py refac: modernize type annotations (PEP 604 / PEP 585) 2026-05-12 17:10:15 +09:00