Skip unreadable local upload files
This commit is contained in:
@@ -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 = '';
|
||||
|
||||
Reference in New Issue
Block a user