s3tables: use path.Join for path construction and align namespace paths

This commit is contained in:
Chris Lu
2026-01-28 09:37:54 -08:00
parent 24c78d524c
commit b01504649d

View File

@@ -2,6 +2,7 @@ package s3tables
import ( import (
"fmt" "fmt"
"path"
"path/filepath" "path/filepath"
"regexp" "regexp"
"time" "time"
@@ -35,17 +36,17 @@ func parseTableFromARN(arn string) (bucketName, namespace, tableName string, err
// getTableBucketPath returns the filer path for a table bucket // getTableBucketPath returns the filer path for a table bucket
func getTableBucketPath(bucketName string) string { func getTableBucketPath(bucketName string) string {
return fmt.Sprintf("%s/%s", TablesPath, bucketName) return path.Join(TablesPath, bucketName)
} }
// getNamespacePath returns the filer path for a namespace // getNamespacePath returns the filer path for a namespace
func getNamespacePath(bucketName, namespace string) string { func getNamespacePath(bucketName, namespace string) string {
return fmt.Sprintf("%s/%s/namespaces/%s", TablesPath, bucketName, namespace) return path.Join(TablesPath, bucketName, namespace)
} }
// getTablePath returns the filer path for a table // getTablePath returns the filer path for a table
func getTablePath(bucketName, namespace, tableName string) string { func getTablePath(bucketName, namespace, tableName string) string {
return fmt.Sprintf("%s/%s/namespaces/%s/%s", TablesPath, bucketName, namespace, tableName) return path.Join(TablesPath, bucketName, namespace, tableName)
} }
// Metadata structures // Metadata structures