jamhall/s3rver

BucketName is empty

Closed this issue · 2 comments

<?xml version="1.0" encoding="UTF-8"?>
<ListBucketResult xmlns="http://doc.s3.amazonaws.com/2006-03-01">
  <IsTruncated>false</IsTruncated>
  <Marker/>
  <Name/>
  <Prefix/>
  <MaxKeys>1000</MaxKeys>

when using the bucketname from the ListBucketResult

java.lang.IllegalArgumentException: BucketName cannot be empty
	at com.amazonaws.util.ValidationUtils.assertStringNotEmpty(ValidationUtils.java:89)
	at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1374)
	at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1271)

regression? https://github.com/jamhall/s3rver/pull/100/files

Seems so 😕

s3rver/lib/controllers.js

Lines 311 to 324 in d69913a

getBucket(req, res) {
if (indexDocument) {
store.getObject(req.params.bucket, indexDocument, (err, object) => {
if (!object) return errorResponse(req, res, indexDocument);
logger.info("Serving Page: %s", object.key);
buildResponse(req, res, 200, object);
});
} else {
const options = {
delimiter: req.query["delimiter"],
marker: req.query["marker"],
maxKeys: Math.min(1000, parseInt(req.query["max-keys"]) || Infinity),
prefix: req.query["prefix"]
};

Thanks @specialkk @n1ru4l :)
Reactive and efficient :D