Repository navigation
Commit ca6ed80
committed
Route _checkWritable and connect-time read-only popup through the writeProtected dialog
The previous PR handled HTTP 409/500 on PUT /fs/* by tagging the
ProtocolError with .writeProtected and showing an actionable dialog
in saveFileContents. But there are two earlier paths users hit FIRST
that were still using the old generic wording:
1. At connect, checkReadOnly() in script.js queries /fs/ for the
writable flag. If false, it popped a one-line warning that said
'Disable the USB drive' without telling users how, what 'eject
may not be enough' means, or where to read more.
2. On save, writeFile() calls _checkWritable() FIRST. If the cached
_writable flag is false, _checkWritable threw a plain Error (not
a ProtocolError, no .writeProtected tag), so the catch block in
saveFileContents never recognized it as the write-protected case
and fell through to 'Saving file failed after multiple attempts.'
This commit:
- Factors the writeProtected ProtocolError shape into a new
_writeProtectedError() helper on FileTransferClient, so both
_checkWritable and the _fetch 409/500 handler return identical
tagged errors (same .hint, .helpUrl, .helpLabel).
- _checkWritable now invalidates the cached _writable flag before
re-checking. Means users who release the drive can save again
without disconnecting/reconnecting the workflow.
- Updates checkReadOnly() in script.js to use the same wording +
clickable Learn-guide link as the per-save dialog. Connect-time
popup is now genuinely informative instead of cryptic.
- Removes the debug console.warn lines from the previous commit
now that we've confirmed the path (the read-only branch was
bypassing the tagged ProtocolError, not a bug in _fetch).
After this change, users see the same actionable message at all
three trip points (connect, pre-save check, server-side response).
The message names USB MSC, points at boot.py, warns that eject
alone is unreliable on macOS, and links to the Learn guide section
that walks them through disabling it.1 parent 5d9b159 commit ca6ed80
2 files changed
Lines changed: 48 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
53 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
54 | 81 | | |
55 | | - | |
| 82 | + | |
56 | 83 | | |
57 | 84 | | |
58 | 85 | | |
| |||
128 | 155 | | |
129 | 156 | | |
130 | 157 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | 158 | | |
141 | 159 | | |
142 | 160 | | |
| |||
146 | 164 | | |
147 | 165 | | |
148 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
149 | 171 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
159 | 175 | | |
160 | 176 | | |
161 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
335 | 347 | | |
336 | 348 | | |
337 | 349 | | |
| |||
594 | 606 | | |
595 | 607 | | |
596 | 608 | | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | 609 | | |
606 | 610 | | |
607 | 611 | | |
| |||
0 commit comments