Comparing version 0.2.6 to 0.2.7
@@ -5,3 +5,4 @@ ### Setup your minio-java Github Repository | ||
Minio Javascript library uses gulp for its dependency management http://gulpjs.com/ | ||
```sh | ||
```bash | ||
$ git clone https://github.com/$USER_ID/minio-js | ||
@@ -8,0 +9,0 @@ $ cd minio-js |
@@ -40,3 +40,4 @@ /* | ||
upload = require('./upload.js'), | ||
xmlParsers = require('./xml-parsers.js'); | ||
xmlParsers = require('./xml-parsers.js'), | ||
errors = require('./errors.js'); | ||
@@ -74,3 +75,3 @@ var Client = (function () { | ||
{ | ||
throw new Error('Unknown protocol: ' + parsedUrl.protocol); | ||
throw new errors.InvalidProtocolException('Unknown protocol: ' + parsedUrl.protocol); | ||
} | ||
@@ -100,3 +101,3 @@ } | ||
if (this.params.userAgentSet) { | ||
throw 'user agent already set'; | ||
throw new errors.InternalClientException('user agent already set'); | ||
} | ||
@@ -107,3 +108,3 @@ if (name && version) { | ||
} else { | ||
throw 'Invalid user agent'; | ||
throw new errors.InvalidUserAgentException('Invalid user agent'); | ||
} | ||
@@ -123,3 +124,3 @@ } | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -215,3 +216,3 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -224,3 +225,3 @@ simpleRequests.bucketRequest(this, 'HEAD', bucket, cb); | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -233,3 +234,3 @@ simpleRequests.bucketRequest(this, 'DELETE', bucket, cb); | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -259,7 +260,7 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (acl === null || acl.trim() === '') { | ||
return cb('acl name cannot be empty'); | ||
throw new errors.InvalidEmptyACLException('Acl name cannot be empty'); | ||
} | ||
@@ -294,3 +295,3 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -304,7 +305,7 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (key === null || key.trim() === '') { | ||
return cb('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -323,7 +324,7 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (key === null || key.trim() === '') { | ||
return cb('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -375,7 +376,7 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (key === null || key.trim() === '') { | ||
return cb('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -396,3 +397,5 @@ | ||
stream.pipe(Through2.obj(function (upload, enc, done) { | ||
uploadId = upload.uploadId; | ||
if (key === upload.key) { | ||
uploadId = upload.uploadId; | ||
} | ||
done(); | ||
@@ -455,5 +458,4 @@ }, function (done) { | ||
value: function listObjects(bucket, params) { | ||
var bucketNameError = false; | ||
if (!helpers.validBucketName(bucket)) { | ||
bucketNameError = true; | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
@@ -481,5 +483,2 @@ var self = this, | ||
if (bucketNameError) { | ||
return done('bucket name invalid'); | ||
} | ||
objectList.list(self.transport, self.params, currentRequest.bucket, currentRequest.prefix, currentRequest.marker, currentRequest.delimiter, currentRequest.maxKeys, function (e, r) { | ||
@@ -524,7 +523,7 @@ if (e) { | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (key === null || key.trim() === '') { | ||
return cb('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -560,7 +559,7 @@ | ||
if (!helpers.validBucketName(bucket)) { | ||
return cb('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (key === null || key.trim() === '') { | ||
return cb('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -573,6 +572,6 @@ simpleRequests.objectRequest(this, 'DELETE', bucket, key, cb); | ||
if (!helpers.validBucketName(bucket)) { | ||
throw new Error('invalid bucket name'); | ||
throw new errors.InvalidBucketNameException('Invalid bucket name: ' + bucket); | ||
} | ||
if (!key || key.trim() === '') { | ||
throw new Error('object key cannot be empty'); | ||
throw new errors.InvalidObjectNameException('Object name cannot be empty'); | ||
} | ||
@@ -579,0 +578,0 @@ var requestParams = { |
@@ -138,8 +138,7 @@ /* | ||
var dropUploads = function dropUploads(transport, params, bucket, key, cb) { | ||
var errored = null; | ||
var queue = new Stream.Readable({ | ||
var errored = null, | ||
queue = new Stream.Readable({ | ||
objectMode: true | ||
}); | ||
queue._read = function () {}; | ||
@@ -180,13 +179,29 @@ queue.pipe(Through2.obj(function (job, enc, done) { | ||
} | ||
abortMultipartUpload(transport, params, upload.bucket, upload.key, upload.uploadId, function (e) { | ||
if (errored) { | ||
return done(); | ||
if (key !== null) { | ||
if (key == upload.key) { | ||
abortMultipartUpload(transport, params, upload.bucket, upload.key, upload.uploadId, function (e) { | ||
if (errored) { | ||
return done(); | ||
} | ||
if (e) { | ||
errored = e; | ||
queue.push(null); | ||
return done(); | ||
} | ||
return done(); | ||
}); | ||
} | ||
if (e) { | ||
errored = e; | ||
queue.push(null); | ||
return done(); | ||
} | ||
done(); | ||
}); | ||
} else { | ||
abortMultipartUpload(transport, params, upload.bucket, upload.key, upload.uploadId, function (e) { | ||
if (errored) { | ||
return done(); | ||
} | ||
if (e) { | ||
errored = e; | ||
queue.push(null); | ||
return done(); | ||
} | ||
done(); | ||
}); | ||
} | ||
}, function (done) { | ||
@@ -193,0 +208,0 @@ cb(errored); |
@@ -70,3 +70,3 @@ /* | ||
// compute size | ||
blockSize = calculateBlockSize(totalSize), | ||
partSize = calculatePartSize(totalSize), | ||
totalSeen = 0; | ||
@@ -76,3 +76,3 @@ | ||
r.pipe(BlockStream2({ | ||
size: blockSize, | ||
size: partSize, | ||
zeroPadding: false | ||
@@ -84,8 +84,11 @@ })).pipe(Through2.obj(function (data, enc, done) { | ||
totalSeen += data.length; | ||
if (totalSeen > totalSize) { | ||
errored = 'actual size does not match specified size'; | ||
return done(); | ||
if (data.length < partSize) { | ||
var expectedSize = totalSize - totalSeen; | ||
if (expectedSize != data.length) { | ||
errored = 'actual size does not match specified size'; | ||
return done(); | ||
} | ||
} | ||
totalSeen += data.length; | ||
var curPart = part; | ||
@@ -137,3 +140,3 @@ part = part + 1; | ||
function calculateBlockSize(size) { | ||
function calculatePartSize(size) { | ||
var minimumPartSize = 5 * 1024 * 1024, | ||
@@ -168,2 +171,3 @@ // 5MB | ||
hashMD5 = Crypto.createHash('md5'); | ||
hash256.update(data); | ||
@@ -170,0 +174,0 @@ hashMD5.update(data); |
{ | ||
"name": "minio", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "S3 Compatible Cloud Storage client", | ||
@@ -5,0 +5,0 @@ "main": "./dist/main/minio.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
203039
28
1949