From 56fcf228fb33bbb03553d7cbc6a15aaf326051b4 Mon Sep 17 00:00:00 2001 From: Michal Niewrzal Date: Wed, 3 Jul 2019 20:56:17 +0200 Subject: [PATCH] Enable bucket name validation (#2449) --- satellite/metainfo/metainfo_test.go | 9 ++------- satellite/metainfo/validation.go | 7 ------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/satellite/metainfo/metainfo_test.go b/satellite/metainfo/metainfo_test.go index e40f4f4c4..8112cd254 100644 --- a/satellite/metainfo/metainfo_test.go +++ b/satellite/metainfo/metainfo_test.go @@ -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) { diff --git a/satellite/metainfo/validation.go b/satellite/metainfo/validation.go index 677980b0e..39d85ac7c 100644 --- a/satellite/metainfo/validation.go +++ b/satellite/metainfo/validation.go @@ -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") }