Skip unreadable local upload files

This commit is contained in:
Mikei386
2026-07-04 10:18:04 +02:00
parent 2e5581a6e9
commit 4e05ef3a8b
5 changed files with 24 additions and 3 deletions
+21
View File
@@ -952,6 +952,21 @@ async function uploadFileList(win, files, targetPath) {
recordDebug('upload.file.done', { path: item.path, index: index + 1, total: uploadItems.length, overwrite: false });
} catch (error) {
if (error.status !== 409) {
if (isLocalFileReadError(error)) {
updateUploadTransfer(transfer, {
skippedFiles: transfer.skippedFiles + 1,
skippedBytes: transfer.skippedBytes + Number(item.file.size || 0),
currentFile: item.path,
progress: uploadProgressPercent(transfer)
}, true);
recordDebug('upload.file.unreadable', {
path: item.path,
index: index + 1,
total: uploadItems.length,
error: serializeError(error)
});
continue;
}
updateUploadTransfer(transfer, {
status: 'failed',
message: error.message || 'Upload fehlgeschlagen',
@@ -1108,6 +1123,12 @@ function uploadProgressPercent(transfer) {
return 0;
}
function isLocalFileReadError(error) {
return error?.name === 'NotReadableError'
|| error?.name === 'NotFoundError'
|| error?.name === 'SecurityError';
}
function arrayBufferToBase64(buffer) {
const bytes = new Uint8Array(buffer);
let binary = '';