Commit 62bbc09
committed
Transfer: Unify entry paths behind one guard + source resolver
- New `pane/transfer-entry.ts` is the shared seam every transfer entry path runs through, so F5/F6, drag-and-drop, and clipboard paste prepare a transfer identically:
- `checkTransferDestinationGuard(destVolumeId, volumes)`: the shared destination guard chain (search-results not-a-folder toast, then read-only "Read-only device" alert). Copy strings unchanged — they're the E2E-asserted contract. An unknown destination id is allowed through (can't prove read-only; the backend still rejects a genuinely read-only write).
- `resolveSourceVolumeId(paths, volumes, resolvePathVolume)`: resolves the REAL source volume for dropped/pasted paths — frontend `findVolumeIdForPath` longest-prefix (handles MTP-shaped paths), backend `resolve_path_volume` fallback for the common parent, honest-unknown `root` default. Never ships a knowingly-wrong id: sources spanning volumes or a failed resolve return `root`.
- F5/F6 (`file-operation-commands.ts`): the inline read-only / search-results guards now call `checkTransferDestinationGuard`. Behavior-preserving; the 37 existing specs stay green.
- Drag-and-drop (`drag-drop-controller.svelte.ts`): runs the shared guard before opening the dialog (field bug 2: dropping onto a read-only volume now shows the same "Read-only device" alert F5 shows, instead of silently opening a copy dialog), and resolves the real source volume id instead of the old `sourceVolumeId = destVolumeId` placeholder (field bug 4: an MTP→local / local→MTP drop now stats the right volume, so the dialog's byte/file/dir counters fill instead of reading 0). `buildTransferPropsFromDroppedPaths` takes the resolved `sourceVolumeId` explicitly.
- Clipboard paste (`clipboard-operations.ts`): runs the shared guard for a read-only destination. The MTP-specific "Use F5…" refusal stays separate and ahead of it (it points the user at the F5/F6 flow paste lacks).
- Tests (red-first for the bug-targeting ones): `transfer-entry.test.ts` (guard + resolver matrix: local / MTP-shaped / spanning / BE-fallback / honest-unknown); drag-drop component tests for the read-only guard (bug 2) and the resolved cross-volume source id (bug 4); a `TransferDialog` test pinning that the dialog forwards the source volume id to `startScanPreview` (the bug-4 seam); a read-only paste guard test. Existing F5/F6 + drag + clipboard + dialog specs unchanged.
- Docs: updated the transfer FE, pane, and drag `CLAUDE.md`s for the new shared-seam architecture.1 parent f4a8b1c commit 62bbc09
13 files changed
Lines changed: 631 additions & 64 deletions
File tree
- apps/desktop/src/lib
- file-explorer
- drag
- pane
- file-operations/transfer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| |||
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| 98 | + | |
88 | 99 | | |
89 | 100 | | |
90 | 101 | | |
| |||
97 | 108 | | |
98 | 109 | | |
99 | 110 | | |
100 | | - | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
105 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
106 | 120 | | |
107 | 121 | | |
108 | 122 | | |
| |||
223 | 237 | | |
224 | 238 | | |
225 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
226 | 257 | | |
227 | 258 | | |
228 | 259 | | |
| |||
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
196 | 199 | | |
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
202 | 216 | | |
203 | 217 | | |
204 | 218 | | |
| |||
0 commit comments