Skip to content

Commit c00700f

Browse files
committed
fixed incorrect parameter logging when parameters were added from user claims as string array (roles, permissions, etc).
1 parent 3badf6f commit c00700f

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

NpgsqlRest/ParameterParser.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,15 +416,28 @@ internal static string FormatParam(object value, TypeDescriptor descriptor)
416416
{
417417
return Consts.Null;
418418
}
419-
// TODO fix this: fix array parameter logging: e.g. -- $6 text[] = 'System.Collections.Generic.List`1[System.String]'
420-
if (descriptor.IsArray && value is IList<object> list)
419+
if (descriptor.IsArray)
421420
{
422-
var d = descriptor;
423-
if (descriptor is { IsNumeric: false, IsBoolean: false })
421+
if (value is IList<object> objectList)
424422
{
425-
return string.Concat("{", string.Join(",", list.Select(x => string.Concat("'", Format(x, d), "'"))), "}");
423+
var d = descriptor;
424+
if (descriptor is { IsNumeric: false, IsBoolean: false })
425+
{
426+
return string.Concat("{", string.Join(",", objectList.Select(x => string.Concat("'", Format(x, d), "'"))),
427+
"}");
428+
}
429+
return string.Concat("{", string.Join(",", objectList.Select(x => Format(x, d))), "}");
430+
}
431+
if (value is IList<string> stringList)
432+
{
433+
var d = descriptor;
434+
if (descriptor is { IsNumeric: false, IsBoolean: false })
435+
{
436+
return string.Concat("{", string.Join(",", stringList.Select(x => string.Concat("'", Format(x, d), "'"))),
437+
"}");
438+
}
439+
return string.Concat("{", string.Join(",", stringList.Select(x => Format(x, d))), "}");
426440
}
427-
return string.Concat("{", string.Join(",", list.Select(x => Format(x, d))), "}");
428441
}
429442
if (descriptor is { IsNumeric: false, IsBoolean: false })
430443
{

changelog.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ private static readonly string[] InfoEventsStreamingScopeKey = [
2929

3030
- TODO fix claims to parameters or user context mapping - if empty string is passed, use null (make it optional with default true)
3131

32-
- TODO fix array parameter logging: e.g. -- $6 text[] = 'System.Collections.Generic.List`1[System.String]'
33-
3432
## Version [3.0.0](https://github.com/NpgsqlRest/NpgsqlRest/tree/3.0.0) (date is TBD)
3533

3634
[Full Changelog](https://github.com/NpgsqlRest/NpgsqlRest/compare/2.36.0...2.36.1)
@@ -428,6 +426,7 @@ rate_limiter [ name ]
428426
- Refactoring: moved some files around to better structure the project.
429427
- Removed unnecessary type casting when routine source returns set with embedded composite type.
430428
- Fix: fixed incorrect handling of types with modifier (e.g. varchar(100), numeric(10,2), etc). This causes type with modifiers to be serialized as incorrect type.
429+
- Fix: fixed incorrect parameter logging when parameters were added from user claims as string array (roles, permissions, etc).
431430

432431
#### Login Endpoint Changes
433432

0 commit comments

Comments
 (0)