Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit 2524bd2

Browse files
committed
try to better handle allocatedspace if not unit is specified
1 parent 10388e5 commit 2524bd2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/utils.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ exports.validateAllocation = function(conf, callback) {
8181
const self = this;
8282

8383
if (!self._isValidStorageAllocationFormat(conf.storageAllocation)) {
84-
return callback(
85-
new Error('Invalid storage size specified: '+ conf.storageAllocation)
86-
);
84+
if (isNaN(conf.storageAllocation)) {
85+
return callback(
86+
new Error('Invalid storage size specified: '+ conf.storageAllocation)
87+
);
88+
}
89+
90+
conf.storageAllocation = conf.storageAllocation.toString() + 'B';
8791
}
8892

8993
self.getFreeSpace(conf.storagePath, function(err, free) {
@@ -95,7 +99,7 @@ exports.validateAllocation = function(conf, callback) {
9599
}
96100

97101
if (allocatedSpace > free + usedSpaceBytes) {
98-
return callback(new Error('Invalid storage size: '+
102+
return callback(new Error('Invalid storage size: '+
99103
-(free + usedSpaceBytes - allocatedSpace) +' bytes missing'));
100104
}
101105

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "storjshare-daemon",
3-
"version": "3.5.3",
3+
"version": "3.5.4",
44
"description": "daemon + process manager for sharing space on the storj network",
55
"main": "index.js",
66
"bin": {

0 commit comments

Comments
 (0)