(item)
| 439 | } |
| 440 | |
| 441 | function validateQueueItem(item) { |
| 442 | if (!item || !isFileLike(item.file)) { |
| 443 | return tx('share_drop_error_invalid_file', null, 'Invalid file.'); |
| 444 | } |
| 445 | if (!allowSubfolders && String(item.relativePath || '').indexOf('/') !== -1) { |
| 446 | return tx( |
| 447 | 'share_drop_error_subfolders_disabled', |
| 448 | null, |
| 449 | 'Skipped: subfolder uploads are not enabled for this share.' |
| 450 | ); |
| 451 | } |
| 452 | if (maxFileSizeBytes > 0 && item.file.size > maxFileSizeBytes) { |
| 453 | return tx( |
| 454 | 'share_drop_error_size_exceeded', |
| 455 | { mb: maxFileSizeMb }, |
| 456 | 'Skipped: file is larger than ' + maxFileSizeMb + ' MB.' |
| 457 | ); |
| 458 | } |
| 459 | if (allowedTypes.length) { |
| 460 | const ext = getExt(item.file.name || ''); |
| 461 | if (!ext || !allowedTypes.includes(ext)) { |
| 462 | return tx('share_drop_error_type_not_allowed', null, 'Skipped: file type not allowed.'); |
| 463 | } |
| 464 | } |
| 465 | return ''; |
| 466 | } |
| 467 | |
| 468 | function makeUploadId() { |
| 469 | try { |
no test coverage detected