diff --git a/weed/s3api/iceberg/iceberg.go b/weed/s3api/iceberg/iceberg.go index a35a2ed90..9235cb6cb 100644 --- a/weed/s3api/iceberg/iceberg.go +++ b/weed/s3api/iceberg/iceberg.go @@ -402,15 +402,10 @@ func parsePagination(r *http.Request) (pageToken string, pageSize int, err error } func normalizeNamespaceProperties(properties map[string]string) map[string]string { - if len(properties) == 0 { + if properties == nil { return map[string]string{} } - - normalized := make(map[string]string, len(properties)) - for k, v := range properties { - normalized[k] = v - } - return normalized + return properties } // handleConfig returns catalog configuration. diff --git a/weed/s3api/iceberg/iceberg_namespace_properties_test.go b/weed/s3api/iceberg/iceberg_namespace_properties_test.go index f0cefaa63..fa80dc342 100644 --- a/weed/s3api/iceberg/iceberg_namespace_properties_test.go +++ b/weed/s3api/iceberg/iceberg_namespace_properties_test.go @@ -12,7 +12,7 @@ func TestNormalizeNamespacePropertiesNil(t *testing.T) { } } -func TestNormalizeNamespacePropertiesClonesInput(t *testing.T) { +func TestNormalizeNamespacePropertiesReturnsInputWhenSet(t *testing.T) { input := map[string]string{ "owner": "analytics", } @@ -22,8 +22,8 @@ func TestNormalizeNamespacePropertiesClonesInput(t *testing.T) { t.Fatalf("normalized properties value = %q, want %q", properties["owner"], "analytics") } - input["owner"] = "mutated" - if properties["owner"] != "analytics" { - t.Fatalf("normalized properties was mutated via input map") + input["owner"] = "updated" + if properties["owner"] != "updated" { + t.Fatalf("normalizeNamespaceProperties should reuse the input map when non-nil") } }