mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 02:09:23 +08:00
The last piece of #866. #899 stopped a linked folder's subdirectories from collapsing, and same-named documents no longer overwrite or vanish — but the reporter's actual workflow still could not rebuild his tree. He added one subtree at a time, and a browser folder pick reports each file's path relative to the chosen directory: `应用开发/钉钉CLI/` arrives as `钉钉CLI/...`, with no way to say it belongs under `应用开发/`. Every batch piled up at the KB root, and the ancestor was not missing data — it was never in the payload. Uploads now take an optional destination folder, composed ahead of each file's own relative path. The picker offers the KB's existing folders (and its root, the default) once files are staged, so batching a large tree is a matter of picking where each part goes. It runs through the same _sanitize_rel_subdir guard as a directory upload's own path, so a crafted value cannot escape raw/. Listing folders is best-effort: if that call fails the picker simply does not appear and the batch goes to the root exactly as before. Linked-folder sync keeps its own root-relative staging and does not take a destination prefix yet — that needs the prefix persisted per linked folder in metadata, which is a separate change.