Enable bucket name validation (#2449)

This commit is contained in:
Michal Niewrzal 2019-07-03 20:56:17 +02:00 committed by Bill Thorp
parent ae8b9698f9
commit 56fcf228fb
2 changed files with 2 additions and 14 deletions

View File

@ -27,7 +27,6 @@ import (
"storj.io/storj/pkg/storj"
"storj.io/storj/satellite"
"storj.io/storj/satellite/console"
satMetainfo "storj.io/storj/satellite/metainfo"
"storj.io/storj/uplink/metainfo"
)
@ -627,11 +626,11 @@ func TestSetAttribution(t *testing.T) {
}
{
//non attributed bucket, and adding files
err = planet.Uplinks[0].Upload(ctx, planet.Satellites[0], "alphaNew", "path", []byte{1, 2, 3})
err = planet.Uplinks[0].Upload(ctx, planet.Satellites[0], "alpha-new", "path", []byte{1, 2, 3})
assert.NoError(t, err)
// bucket with items
err = metainfoClient.SetAttribution(ctx, "alphaNew", partnerID)
err = metainfoClient.SetAttribution(ctx, "alpha-new", partnerID)
require.Error(t, err)
}
})
@ -729,10 +728,6 @@ func createTestPointer(t *testing.T) *pb.Pointer {
}
func TestBucketNameValidation(t *testing.T) {
if !satMetainfo.BucketNameRestricted {
t.Skip("Skip until bucket name validation is not enabled")
}
testplanet.Run(t, testplanet.Config{
SatelliteCount: 1, StorageNodeCount: 6, UplinkCount: 1,
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {

View File

@ -25,9 +25,6 @@ import (
)
const (
// BucketNameRestricted feature flag to toggle bucket name validation
BucketNameRestricted = false
requestTTL = time.Hour * 4
)
@ -236,10 +233,6 @@ func (endpoint *Endpoint) validateBucket(ctx context.Context, bucket []byte) (er
return Error.New("bucket not specified")
}
if !BucketNameRestricted {
return nil
}
if len(bucket) < 3 || len(bucket) > 63 {
return Error.New("bucket name must be at least 3 and no more than 63 characters long")
}