Skip to content

Commit

Permalink
fix filter overrides with nil
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrek-janus committed Jul 17, 2024
1 parent 773f457 commit 6503ca3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions internal/cac/storage/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package storage
import (
"context"
"fmt"

"github.com/cloudentity/acp-client-go/clients/hub/models"
"github.com/cloudentity/cac/internal/cac/api"
"github.com/imdario/mergo"
Expand Down
6 changes: 1 addition & 5 deletions internal/cac/storage/tenant_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ func (t *TenantStorage) Read(ctx context.Context, opts ...api.SourceOpt) (models
return nil, err
}

if err = readFilesToMap(tenant, "themes", filepath.Join(path, "themes")); err != nil {
return nil, err
}

if themeDirs, err = listDirsInPath(filepath.Join(path, "themes")); err != nil {
return nil, err
}
Expand All @@ -144,7 +140,7 @@ func (t *TenantStorage) Read(ctx context.Context, opts ...api.SourceOpt) (models
templatesConfig map[string]any
)

if templatesConfig, err = readFiles(filepath.Join(path, "themes", normalize(theme.Name), "templates")); err != nil {
if templatesConfig, err = readFiles(filepath.Join(path, "themes", dir, "templates")); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/cac/storage/tenant_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ updated_at: 0001-01-01T00:00:00.000Z
st, err := storage.InitMultiStorage(&storage.MultiStorageConfiguration{
DirPath: []string{t.TempDir(), t.TempDir()},
}, storage.InitTenantStorage)

q

Check failure on line 198 in internal/cac/storage/tenant_storage_test.go

View workflow job for this annotation

GitHub Actions / test

undefined: q
require.NoError(t, err)

patchData, err := utils.FromModelToPatch(tc.data)
Expand Down
4 changes: 3 additions & 1 deletion internal/cac/utils/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ func FilterPatch(patch models.Rfc7396PatchOperation, filters []string) (models.R
filter = mapped
}

newPatch[filter] = patch[filter]
if _, ok := patch[filter]; ok {
newPatch[filter] = patch[filter]
}
}

return newPatch, nil
Expand Down

0 comments on commit 6503ca3

Please sign in to comment.