Summary
Files of recognized types end up in the other bucket instead of their type bucket (audio, documents, …). On one account: audio has 2 objects while other has 147 — including .mp3/.wav audio and .md documents. This is a categorization/routing bug, not data loss — the files are intact in other.
Root cause
The per-file classifier is correct: FileCategory.fromExtension maps mp3/wav -> audio, md -> documents (lib/core/services/file_service.dart). The main per-file upload paths use it correctly:
lib/app/app.dart:389,400 -> remoteBucket: category.bucketName
lib/features/browser/screens/file_browser_screen.dart:2285 (single file), :2323 (folder, per-file)
But two routes assign a single fixed bucket to a whole batch, bypassing per-file classification:
- Stale "mixed -> other" relic.
_uploadFolder (file_browser_screen.dart:2310) carries the comment // Determine bucket - use ''other'' for mixed folder contents over code that now classifies per file. It documents an earlier behavior (reworked around 63cfcb4, 2025-12-14 "folder sync") where mixed folders were dumped into other. Files uploaded by that earlier version remain in other.
- Folder/background sync uploads to a configured bucket.
background_sync_service._executeUploadTask (background_sync_service.dart:143-153) uploads to inputData[''bucket''] — a bucket fixed by the sync task, not per-file. A folder-sync pointed at a target bucket routes ALL its files there regardless of type.
Impact
- Type-based browsing (Audio/Documents tabs) shows the type buckets near-empty while the files sit in
other.
- It also muddies recovery: a near-empty
audio bucket with a broken forest looks like data loss when the real audio is safe in other.
Observed (one account)
audio=2 objects, documents~75, other=147. .mp3, .wav, and .md files visible under other.
Suggested fixes (later, after recovery)
- Remove the stale "mixed -> other" relic; ensure every upload path classifies per file.
- Folder-sync: make the destination explicit (per-file categories vs one bucket) and surface it in the UI.
- Add a MIME fallback (
lookupMimeType, already imported) and handle no-extension files — FileCategory.fromPath does path.split(''.'').last, so an extension-less name returns the whole filename -> other.
- Optional: a re-bucketing/migration tool to move mis-filed files from
other to the correct type buckets.
Not data loss — files are intact in other; this is purely which bucket they are filed under.
Summary
Files of recognized types end up in the
otherbucket instead of their type bucket (audio,documents, …). On one account:audiohas 2 objects whileotherhas 147 — including.mp3/.wavaudio and.mddocuments. This is a categorization/routing bug, not data loss — the files are intact inother.Root cause
The per-file classifier is correct:
FileCategory.fromExtensionmapsmp3/wav -> audio,md -> documents(lib/core/services/file_service.dart). The main per-file upload paths use it correctly:lib/app/app.dart:389,400->remoteBucket: category.bucketNamelib/features/browser/screens/file_browser_screen.dart:2285(single file),:2323(folder, per-file)But two routes assign a single fixed bucket to a whole batch, bypassing per-file classification:
_uploadFolder(file_browser_screen.dart:2310) carries the comment// Determine bucket - use ''other'' for mixed folder contentsover code that now classifies per file. It documents an earlier behavior (reworked around63cfcb4, 2025-12-14 "folder sync") where mixed folders were dumped intoother. Files uploaded by that earlier version remain inother.background_sync_service._executeUploadTask(background_sync_service.dart:143-153) uploads toinputData[''bucket'']— a bucket fixed by the sync task, not per-file. A folder-sync pointed at a target bucket routes ALL its files there regardless of type.Impact
other.audiobucket with a broken forest looks like data loss when the real audio is safe inother.Observed (one account)
audio=2 objects,documents~75,other=147..mp3,.wav, and.mdfiles visible underother.Suggested fixes (later, after recovery)
lookupMimeType, already imported) and handle no-extension files —FileCategory.fromPathdoespath.split(''.'').last, so an extension-less name returns the whole filename ->other.otherto the correct type buckets.Not data loss — files are intact in
other; this is purely which bucket they are filed under.