If the user does a Move which fails (say, due to a read-only filesystem), there is no error indication.
To reproduce: Connect over the BLE workflow with CIRCUITPY mounted over USB, so the filesystem is read-only to CircuitPython, then move any file. The device returns STATUS_ERROR, the client rejects, and the dialog does nothing. Unplugging USB and powering the board separately makes the same move succeed.
Suggested fix details
_handleMoveButton() in js/common/file_dialog.js treats a failed move as a falsy return value:
} else if (!(await this._showBusy(this._fileHelper.move(oldPath, newPath)))) {
this._showMessage(`Error moving ${oldPath} to ${newPath}. Make sure the file you are moving exists.`);
errors = true;
}
But move() rejects on failure rather than returning false. processMoveStatus() in @adafruit/ble-file-transfer-js calls this._reject("Unable to move file") when the device answers STATUS_ERROR, and showBusy() is try/finally with no catch, so the rejection propagates out of the handler. _showMessage() never runs, the loop over selected files aborts, and _openFolder(newFolder) never runs.
By contrast, _handleRenameButton(), the next function in the file, already wraps its move() call in try/catch.
To fix, catch the rejection and show its message, which is more specific than the current text:
} else {
try {
await this._showBusy(this._fileHelper.move(oldPath, newPath));
} catch (e) {
this._showMessage(`Error moving ${oldPath} to ${newPath}: ${e}`);
errors = true;
}
}
[originally written by Claude, greatly pruned and edited for clarity by @dhalbert]
If the user does a Move which fails (say, due to a read-only filesystem), there is no error indication.
To reproduce: Connect over the BLE workflow with CIRCUITPY mounted over USB, so the filesystem is read-only to CircuitPython, then move any file. The device returns
STATUS_ERROR, the client rejects, and the dialog does nothing. Unplugging USB and powering the board separately makes the same move succeed.Suggested fix details
_handleMoveButton()injs/common/file_dialog.jstreats a failed move as a falsy return value:But
move()rejects on failure rather than returning false.processMoveStatus()in@adafruit/ble-file-transfer-jscallsthis._reject("Unable to move file")when the device answersSTATUS_ERROR, andshowBusy()istry/finallywith nocatch, so the rejection propagates out of the handler._showMessage()never runs, the loop over selected files aborts, and_openFolder(newFolder)never runs.By contrast,
_handleRenameButton(), the next function in the file, already wraps itsmove()call intry/catch.To fix, catch the rejection and show its message, which is more specific than the current text:
[originally written by Claude, greatly pruned and edited for clarity by @dhalbert]