diff --git a/internal/actions/object/metadata.go b/internal/actions/object/metadata.go index ba66604f15..0167a1e056 100644 --- a/internal/actions/object/metadata.go +++ b/internal/actions/object/metadata.go @@ -22,6 +22,14 @@ func UserMetadataListFromQuery(c *actions.FieldConfig, metadata *query.UserMetad for i, md := range metadata.Metadata { var value interface{} + if !json.Valid(md.Value) { + var err error + md.Value, err = json.Marshal(string(md.Value)) + if err != nil { + logging.WithError(err).Debug("unable to marshal unknow value") + panic(err) + } + } err := json.Unmarshal(md.Value, &value) if err != nil { logging.WithError(err).Debug("unable to unmarshal into map") diff --git a/internal/logstore/emitters/access/database.go b/internal/logstore/emitters/access/database.go index 494789cdb1..bc121612e3 100644 --- a/internal/logstore/emitters/access/database.go +++ b/internal/logstore/emitters/access/database.go @@ -49,6 +49,9 @@ func (l *databaseLogStorage) QuotaUnit() quota.Unit { } func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error { + if len(bulk) == 0 { + return nil + } builder := squirrel.Insert(accessLogsTable). Columns( accessTimestampCol, diff --git a/internal/logstore/emitters/execution/database.go b/internal/logstore/emitters/execution/database.go index 499fedd931..106b433200 100644 --- a/internal/logstore/emitters/execution/database.go +++ b/internal/logstore/emitters/execution/database.go @@ -42,6 +42,9 @@ func (l *databaseLogStorage) QuotaUnit() quota.Unit { } func (l *databaseLogStorage) Emit(ctx context.Context, bulk []logstore.LogRecord) error { + if len(bulk) == 0 { + return nil + } builder := squirrel.Insert(executionLogsTable). Columns( executionTimestampCol,