Skip to content

Commit 54829e3

Browse files
authored
Test dot segment in S3 URI Label (#4659)
1 parent b4e67d5 commit 54829e3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/services/s3.spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -3944,4 +3944,34 @@ describe('AWS.S3', function() {
39443944
});
39453945
});
39463946
});
3947+
3948+
describe('Dot Segment in URI Label', function() {
3949+
it('S3PreservesLeadingDotSegmentInUriLabel', function(done) {
3950+
s3 = new AWS.S3({region: 'us-west-2'});
3951+
helpers.mockHttpResponse(200, {}, '');
3952+
var request = s3.getObject({
3953+
Bucket: 'bucket',
3954+
Key: '../key.txt'
3955+
});
3956+
request.send(function(err, data) {
3957+
expect(err).to.not.exist;
3958+
expect(request.httpRequest.path).to.equal('/../key.txt');
3959+
done();
3960+
});
3961+
});
3962+
3963+
it('S3PreservesEmbeddedDotSegmentInUriLabel', function(done) {
3964+
s3 = new AWS.S3({region: 'us-west-2'});
3965+
helpers.mockHttpResponse(200, {}, '');
3966+
var request = s3.getObject({
3967+
Bucket: 'bucket',
3968+
Key: 'foo/../key.txt'
3969+
});
3970+
request.send(function(err, data) {
3971+
expect(err).to.not.exist;
3972+
expect(request.httpRequest.path).to.equal('/foo/../key.txt');
3973+
done();
3974+
});
3975+
});
3976+
});
39473977
});

0 commit comments

Comments
 (0)