fix: Allow dashes in storage_prefix config (#16934)

pull/16935/head
matthewhudsonedb 2 months ago committed by GitHub
parent e77bf98330
commit c01d9c7512
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      docs/sources/shared/configuration.md
  2. 8
      pkg/storage/bucket/client.go

@ -6878,7 +6878,7 @@ bos:
[secret_key: <string> | default = ""]
# Prefix for all objects stored in the backend storage. For simplicity, it may
# only contain digits and English alphabet letters.
# only contain digits, English alphabet letters and dashes.
# CLI flag: -<prefix>.storage-prefix
[storage_prefix: <string> | default = ""]
```

@ -45,15 +45,15 @@ const (
// BOS is the value for the Baidu Cloud BOS storage backend
BOS = "bos"
// validPrefixCharactersRegex allows only alphanumeric characters to prevent subtle bugs and simplify validation
validPrefixCharactersRegex = `^[\da-zA-Z]+$`
// validPrefixCharactersRegex allows only alphanumeric characters and dashes to prevent subtle bugs and simplify validation
validPrefixCharactersRegex = `^[\da-zA-Z-]+$`
)
var (
SupportedBackends = []string{S3, GCS, Azure, Swift, Filesystem, Alibaba, BOS}
ErrUnsupportedStorageBackend = errors.New("unsupported storage backend")
ErrInvalidCharactersInStoragePrefix = errors.New("storage prefix contains invalid characters, it may only contain digits and English alphabet letters")
ErrInvalidCharactersInStoragePrefix = errors.New("storage prefix contains invalid characters, it may only contain digits, English alphabet letters and dashes")
metrics *objstore.Metrics
@ -113,7 +113,7 @@ func (cfg *Config) RegisterFlagsWithPrefixAndDefaultDirectory(prefix, dir string
cfg.Filesystem.RegisterFlagsWithPrefixAndDefaultDirectory(prefix, dir, f)
cfg.Alibaba.RegisterFlagsWithPrefix(prefix, f)
cfg.BOS.RegisterFlagsWithPrefix(prefix, f)
f.StringVar(&cfg.StoragePrefix, prefix+"storage-prefix", "", "Prefix for all objects stored in the backend storage. For simplicity, it may only contain digits and English alphabet letters.")
f.StringVar(&cfg.StoragePrefix, prefix+"storage-prefix", "", "Prefix for all objects stored in the backend storage. For simplicity, it may only contain digits, English alphabet letters and dashes.")
}
func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {

Loading…
Cancel
Save