Skip to content

Commit

Permalink
Fix bucket alias
Browse files Browse the repository at this point in the history
  • Loading branch information
steevepay committed Mar 24, 2023
1 parent ddef3fb commit 5443e36
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v1.0.2
- Fixed Bucket aliases generating a false AWS4 signature

### v1.0.1
- Remove unused code
- Update documentation
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": "tiny-storage-client",
"version": "1.0.1",
"version": "1.0.2",
"description": "Tiny node client to request distributed AWS S3 or the OpenStack Swift Object Storage.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function request (method, path, options, callback) {
/** REQUIRED FOR AWS4 SIGNATURE */
service: 's3',
hostname: _activeStorage.url,
path: `${path}${_urlParams ?? ''}`,
path: `${_path}${_urlParams ?? ''}`,
region: _activeStorage.region,
protocol: 'https:'
}, {
Expand Down
35 changes: 11 additions & 24 deletions tests/s3.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const fileXml = fs.readFileSync(fileXmlPath).toString();
const _listObjectsResponseXML = fs.readFileSync(path.join(__dirname, "./assets", 'listObjects.response.xml'));
const _listObjectsResponseJSON = require('./assets/listObjects.response.json');

describe.only('S3 SDK', function () {
describe('S3 SDK', function () {

beforeEach(function() {
storage = s3([{
Expand Down Expand Up @@ -94,27 +94,6 @@ describe.only('S3 SDK', function () {
});
})

describe('request - CALLBACK', function() {

describe("REQUEST MAIN STORAGE", function () {

});

describe("SWITCH TO CHILD STORAGE", function () {
});

});

describe('request - STREAM', function() {

describe("REQUEST MAIN STORAGE", function () {
});

describe("SWITCH TO CHILD STORAGE", function () {
});

});

describe('headBucket', function() {
describe("REQUEST MAIN STORAGE", function () {

Expand Down Expand Up @@ -590,10 +569,18 @@ describe.only('S3 SDK', function () {
'x-amz-request-id': '318BC8BC148832E5',
'x-amz-id-2': 'eftixk72aD6Ap51TnqcoF8eFidJG9Z/2mkiDFu8yU9AS1ed4OpIszj7UDNEHGran'
}
const nockRequest = nock(url1S3)
const nockRequest = nock(url1S3, {
reqheaders: {
'x-amz-content-sha256': () => true,
'x-amz-date': () => true,
'authorization': () => true,
'host': () => true
}
})
.defaultReplyHeaders(_header)
.get('/invoices-gra-1234/file.docx')
.reply(200, () => {
.reply(200, (uri, body) => {
console.log(uri);
return fileTxt;
});
storage.downloadFile('invoices', 'file.docx', function (err, resp) {
Expand Down

0 comments on commit 5443e36

Please sign in to comment.