Skip to content

Bug: SharePoint imports inherit a previously visited OneDrive folder #3922

Closed

Description

@yannickmonney

SharePoint import reuses a previously visited OneDrive folder as its destination path

Candidate: sharepoint-import-reuses-onedrive-folder-path-20260929 · P2.

After browsing a OneDrive subfolder, switching to SharePoint and importing a library-root file carries the unrelated OneDrive folder name into the import path. The native importer uses it to choose/create a subfolder under the hub destination, although the SharePoint breadcrumb shows the library root.

Reproduction:

  1. Open Documents in a destination folder (fixture hub-target) → Upload documents → From Microsoft 365.
  2. On My OneDrive, open a folder named PersonalBudget. Select nothing there.
  3. Switch to SharePoint Sites, open Audit Site → Audit Library. Stay at the library root.
  4. Select Report.txt, choose Import (1), keep One-time import, then press Import 1 item.

Expected: Report.txt lands directly in the chosen Tale hub folder. Visiting a different provider first must not affect placement. Opening a fresh picker and importing the identical SharePoint item does exactly that.

Actual: the actual dialog sends the correct SharePoint siteId/driveId/sourceType, but relativePath: 'PersonalBudget/Report.txt'. The current native import pipeline requests getOrCreateFolderPath(org, ['PersonalBudget'], user, undefined, 'hub-target'), then passes that returned child folder ID to createDocument. The fresh SharePoint control sends Report.txt, makes no child-folder request, and creates the document in hub-target. The OneDrive control legitimately includes PersonalBudget for a file actually selected there.

Root cause: onedrive-import-dialog.tsx:459 switches providers without clearing the remembered OneDrive folderPath; :487 always constructs currentRelativePath from that OneDrive state rather than the active provider's path. :512 attaches the SharePoint identity after the path has already been assembled. The route's import schema accepts relativePath and forwards the items to the native pipeline; backend/core/onedrive/import_files.ts:292 derives destination segments directly from that path.

Oracle: docs/en/platform/knowledge/documents.md says One-time import preserves the selection's folder structure and treats My OneDrive and SharePoint Sites as distinct sources. Merged #3420 specifies a path-less pick lands in the chosen destination and provider subfolders mirror underneath it. This file is at the SharePoint library root, so the earlier OneDrive folder is not part of its structure.

Evidence: sharepoint-after-onedrive.json, sharepoint-fresh.json, onedrive-folder-control.json, corresponding native-*.json, and chromium-evidence.json. chromium-sharepoint-after-onedrive-before-import.png shows the SharePoint library-root selection; payload JSON records the unrelated prefix. The actual native import function runs with inert provider/storage/DB/indexing dependencies. This proves the destination requested by current business logic, not persistence in a real database or an actual Microsoft account.

Dedup: same ledger/baseline/latest snapshot plus live SharePoint/OneDrive/cloud searches and merged path/selection PRs. #3420 fixes hub destination propagation; this is a separate current-source prefix leak after switching providers. #3186 fixes sync ownership; #3166 fixes listing bounds; #3804 fixes checkbox naming/session recovery; #3905 fixes listing/import error wording. No merged fix or reported issue matches this wrong-source path. Raw search/PR evidence is retained here.

Source: f406afc4aa0d4b916d6f09ff9781400a92d7f4d0 (live GitHub main, #3905 merged 2026-09-29T14:09:10Z). Final read-only commits/main check at 2026-09-29T14:29:58.628196+00:00 returned the same SHA. Detached source: /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/checkout. Tracked product source is unchanged.

Proof: actual current components with real shared controls/catalog in Chromium and jsdom. External listings/actions use synthetic owned fixtures. Provider, storage and database writes are never performed. ui.log: 10/10; chromium.log: 10/10; native.log: 3/3. Browser evidence is collected in chromium-evidence.json and PNGs. Native import tests consume the payload captured from the component run; run UI before native.

Replay commands:

cd /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/checkout && ./node_modules/.bin/vitest --run --config /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/vitest.config.ts --reporter=verbose --silent=false
cd /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/checkout && ./node_modules/.bin/vitest --run --config /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/vitest.browser.config.ts --reporter=verbose --silent=false
cd /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/checkout && ./node_modules/.bin/vitest --run --config /Users/yannick/.codex/notes/tale-1000-additional/files-current-next/vitest.native.config.ts --reporter=verbose --silent=false

Coordinator verification

The coordinator read the actual selection and path assembly handlers and native intendedFolderId logic, inspected the captured component/native payloads and browser screenshot, and independently reran 10 component, 10 Chromium and 3 native cases with exit 0. Logs: parent-ui.log, parent-browser.log, parent-native.log. These include controls and unrelated Move/Rename checks, not 23 distinct bugs. Final head matches the tested full source SHA. No real provider, storage or database operation is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions