Compare commits

...

1 Commits

Author SHA1 Message Date
Dora Korpar 785e86488d bf: S3C-1286 increase bucketname length 2020-07-27 15:45:28 -07:00
2 changed files with 11 additions and 4 deletions

View File

@ -886,7 +886,7 @@ const routesUtils = {
// eslint-disable-next-line no-useless-escape
const dnsRegex = new RegExp(/^[a-z0-9]+((\.|\-+)[a-z0-9]+)*$/);
// Must be at least 3 and no more than 63 characters long.
if (bucketname.length < 3 || bucketname.length > 63) {
if (bucketname.length < 3 || bucketname.length > 255) {
return false;
}
// Certain prefixes may be reserved, for example for shadow buckets

View File

@ -34,9 +34,8 @@ describe('routesUtils.isValidBucketName', () => {
});
it('should return false if bucketname is greater than ' +
'63 characters long', () => {
const longString = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
'255 characters long', () => {
const longString = 'a'.repeat(256);
const result =
routesUtils.isValidBucketName(longString, prefixBlacklist);
assert.strictEqual(result, false);
@ -79,6 +78,14 @@ describe('routesUtils.isValidBucketName', () => {
assert.strictEqual(result, true);
});
it('should return true if bucketname is greater than 63 characters ' +
'but less than 256', () => {
const longString = 'a'.repeat(64);
const result =
routesUtils.isValidBucketName(longString, prefixBlacklist);
assert.strictEqual(result, true);
});
describe('should return true when bucket name has valid' +
' combination of dots and hyphens', () => {
validBucketNamesWithDotsAndHyphens.forEach(bucketName => {