s3tables: add bucket name validation and fix error handling
- Add isValidBucketName validation function for [a-z0-9_-] characters - Validate bucket name characters match ARN parsing regex - Fix error handling in WithFilerClient closure - properly check for lookup errors - Add error handling for json.Marshal calls (metadata and tags) - Improve error messages and logging
This commit is contained in:
@@ -78,6 +78,13 @@ type tableMetadataInternal struct {
|
||||
|
||||
// Utility functions
|
||||
|
||||
// isValidBucketName validates bucket name characters
|
||||
// Bucket names must contain only lowercase letters, numbers, hyphens, and underscores
|
||||
func isValidBucketName(name string) bool {
|
||||
pattern := regexp.MustCompile(`^[a-z0-9_-]+$`)
|
||||
return pattern.MatchString(name)
|
||||
}
|
||||
|
||||
// generateVersionToken generates a unique version token
|
||||
func generateVersionToken() string {
|
||||
return fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
|
||||
Reference in New Issue
Block a user