diff --git a/.gitignore b/.gitignore index 2ffdc63..3c3629e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -keys.mine.js -*~ +node_modules diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/lib/simpledb.js b/lib/simpledb.js index 965aa7b..aef7ddc 100644 --- a/lib/simpledb.js +++ b/lib/simpledb.js @@ -214,14 +214,24 @@ exports.SimpleDB = function(opts,logger) { function getattrs(out,attrs,asarrays) { + attrs.forEach(function(attr){ - var n = out[attr.Name] - + var n = out[attr.Name], + val = attr.Value; + + if (typeof val === 'object') { + if (val['@'] && val['@'].encoding === 'base64') { // Check for base64 encoding + val = new Buffer(val['#'], 'base64').toString('utf8'); + } else { // The XML parser returns empty strings as val = {} + val = ''; + } + } + if( asarrays ) { - (out[attr.Name] = n?n:[]).push(attr.Value) + (out[attr.Name] = n?n:[]).push(val) } else { - out[attr.Name] = (n?n+',':'') + attr.Value + out[attr.Name] = (n?n+',':'') + val } }) } diff --git a/package.json b/package.json index fed2294..7c73c80 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "John Roberts " ], "dependencies": { - "aws-lib": ">0.0.1" + "aws-lib": "git://github.com/livelycode/aws-lib.git#46b88355d6c2117447c4c4b0252aa7a4953ad74e" }, "main": "lib/simpledb", "directories": { @@ -20,4 +20,4 @@ "engines": { "node": "*" } -} \ No newline at end of file +}