mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 19:26:33 +00:00
Merge pull request #2552 from balena-io/reject-drives-null-size
fix(GUI): Reject drives with null size
This commit is contained in:
commit
aa1e83dc24
@ -92,7 +92,7 @@ class BlockDeviceAdapter extends EventEmitter {
|
|||||||
if (drive.busType === 'RAID') {
|
if (drive.busType === 'RAID') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return !drive.error && (options.includeSystemDrives || !drive.isSystem)
|
return !drive.error && Number.isFinite(drive.size) && (options.includeSystemDrives || !drive.isSystem)
|
||||||
}).map((drive) => {
|
}).map((drive) => {
|
||||||
drive.displayName = drive.device
|
drive.displayName = drive.device
|
||||||
if (/PhysicalDrive/i.test(drive.device) && drive.mountpoints.length) {
|
if (/PhysicalDrive/i.test(drive.device) && drive.mountpoints.length) {
|
||||||
|
@ -65,7 +65,7 @@ describe('Model: availableDrives', function () {
|
|||||||
{
|
{
|
||||||
device: '/dev/sdb',
|
device: '/dev/sdb',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [ {
|
mountpoints: [ {
|
||||||
path: '/mnt/foo'
|
path: '/mnt/foo'
|
||||||
} ],
|
} ],
|
||||||
@ -82,7 +82,7 @@ describe('Model: availableDrives', function () {
|
|||||||
{
|
{
|
||||||
device: '/dev/sdb',
|
device: '/dev/sdb',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [ {
|
mountpoints: [ {
|
||||||
path: '/mnt/foo'
|
path: '/mnt/foo'
|
||||||
} ],
|
} ],
|
||||||
|
@ -118,7 +118,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '/dev/sdb',
|
device: '/dev/sdb',
|
||||||
displayName: '/dev/sdb',
|
displayName: '/dev/sdb',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: '/mnt/foo'
|
path: '/mnt/foo'
|
||||||
@ -131,7 +131,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '/dev/sdc',
|
device: '/dev/sdc',
|
||||||
displayName: '/dev/sdc',
|
displayName: '/dev/sdc',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: '/mnt/bar'
|
path: '/mnt/bar'
|
||||||
@ -158,7 +158,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '/dev/sdb',
|
device: '/dev/sdb',
|
||||||
displayName: '/dev/sdb',
|
displayName: '/dev/sdb',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: '/mnt/foo'
|
path: '/mnt/foo'
|
||||||
@ -172,7 +172,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '/dev/sdc',
|
device: '/dev/sdc',
|
||||||
displayName: '/dev/sdc',
|
displayName: '/dev/sdc',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: '/mnt/bar'
|
path: '/mnt/bar'
|
||||||
@ -230,7 +230,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE2',
|
device: '\\\\.\\PHYSICALDRIVE2',
|
||||||
displayName: '\\\\.\\PHYSICALDRIVE2',
|
displayName: '\\\\.\\PHYSICALDRIVE2',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
isRemovable: false
|
isRemovable: false
|
||||||
@ -239,7 +239,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE3',
|
device: '\\\\.\\PHYSICALDRIVE3',
|
||||||
displayName: 'F:',
|
displayName: 'F:',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: 'F:'
|
path: 'F:'
|
||||||
@ -266,7 +266,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE2',
|
device: '\\\\.\\PHYSICALDRIVE2',
|
||||||
displayName: '\\\\.\\PHYSICALDRIVE2',
|
displayName: '\\\\.\\PHYSICALDRIVE2',
|
||||||
description: 'Foo',
|
description: 'Foo',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [],
|
mountpoints: [],
|
||||||
adapter: 'blockdevice',
|
adapter: 'blockdevice',
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
@ -276,7 +276,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE3',
|
device: '\\\\.\\PHYSICALDRIVE3',
|
||||||
displayName: 'F:',
|
displayName: 'F:',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: 'F:'
|
path: 'F:'
|
||||||
@ -309,7 +309,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE3',
|
device: '\\\\.\\PHYSICALDRIVE3',
|
||||||
raw: '\\\\.\\PHYSICALDRIVE3',
|
raw: '\\\\.\\PHYSICALDRIVE3',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: 'F:'
|
path: 'F:'
|
||||||
@ -355,7 +355,7 @@ describe('Browser: driveScanner', function () {
|
|||||||
device: '\\\\.\\PHYSICALDRIVE3',
|
device: '\\\\.\\PHYSICALDRIVE3',
|
||||||
raw: '\\\\.\\PHYSICALDRIVE3',
|
raw: '\\\\.\\PHYSICALDRIVE3',
|
||||||
description: 'Bar',
|
description: 'Bar',
|
||||||
size: '14G',
|
size: 14000000000,
|
||||||
mountpoints: [
|
mountpoints: [
|
||||||
{
|
{
|
||||||
path: 'F:'
|
path: 'F:'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user