fix(desktop): address code-review findings on the desktop wave
- fileEntries: a single unreadable file/dir in a dropped folder no longer aborts the whole traversal (try/catch per entry, skip failures) — was discarding ALL dropped files (incl. the flat-file path) + an unhandled rejection; also add .catch in both useFileDrop consumers. - RoomInput: mirror a localStorage-restored draft into the draft atom so the P5-57 indicator reflects a persisted draft after a page reload, not only on same-session room re-entry. - useTauriThumbbar: swallow toggleMicrophone()/hangup() rejections (parity with SMTC) — avoids an unhandled rejection when clicked mid-teardown. - App/DesktopChrome: keep wrapper element types stable across the chrome toggle (display:contents when off) so flipping it no longer remounts RouterProvider. - settings: normalizeComposerToolbarOrder also appends missing keys from the canonical key set (safety net if a new button is absent from the default order). Gates: tsc/eslint/prettier clean, build OK, 559 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -77,16 +77,28 @@ export const filesFromEntries = async (
|
||||
const walk = async (entry: FileSystemEntry, prefix: string): Promise<void> => {
|
||||
if (files.length >= maxFiles) return;
|
||||
|
||||
// A single unreadable file/directory (moved between drop and read, a
|
||||
// permissions/lock error, an OS special file) must NOT abort the whole
|
||||
// traversal — skip it and keep collecting the rest.
|
||||
if (entry.isFile) {
|
||||
const file = await fileFromFileEntry(entry as FileSystemFileEntry);
|
||||
if (files.length >= maxFiles) return;
|
||||
files.push(prefix ? renameFile(file, `${prefix}${file.name}`) : file);
|
||||
try {
|
||||
const file = await fileFromFileEntry(entry as FileSystemFileEntry);
|
||||
if (files.length >= maxFiles) return;
|
||||
files.push(prefix ? renameFile(file, `${prefix}${file.name}`) : file);
|
||||
} catch {
|
||||
/* skip unreadable file */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.isDirectory) {
|
||||
const reader = (entry as FileSystemDirectoryEntry).createReader();
|
||||
const childEntries = await readAllDirectoryEntries(reader);
|
||||
let childEntries: FileSystemEntry[] = [];
|
||||
try {
|
||||
const reader = (entry as FileSystemDirectoryEntry).createReader();
|
||||
childEntries = await readAllDirectoryEntries(reader);
|
||||
} catch {
|
||||
return; /* skip unreadable directory */
|
||||
}
|
||||
const childPrefix = `${prefix}${entry.name}/`;
|
||||
for (const child of childEntries) {
|
||||
if (files.length >= maxFiles) break;
|
||||
|
||||
Reference in New Issue
Block a user