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

Commit

Permalink
try to better handle allocatedspace if not unit is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
aleitner committed Jul 24, 2017
1 parent 10388e5 commit 2524bd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ exports.validateAllocation = function(conf, callback) {
const self = this;

if (!self._isValidStorageAllocationFormat(conf.storageAllocation)) {
return callback(
new Error('Invalid storage size specified: '+ conf.storageAllocation)
);
if (isNaN(conf.storageAllocation)) {
return callback(
new Error('Invalid storage size specified: '+ conf.storageAllocation)
);
}

conf.storageAllocation = conf.storageAllocation.toString() + 'B';
}

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

if (allocatedSpace > free + usedSpaceBytes) {
return callback(new Error('Invalid storage size: '+
return callback(new Error('Invalid storage size: '+
-(free + usedSpaceBytes - allocatedSpace) +' bytes missing'));
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "storjshare-daemon",
"version": "3.5.3",
"version": "3.5.4",
"description": "daemon + process manager for sharing space on the storj network",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit 2524bd2

Please sign in to comment.