Skip to content

Commit

Permalink
handle both float and string filterIds
Browse files Browse the repository at this point in the history
  • Loading branch information
o-fl0w committed Nov 21, 2023
1 parent cf4d941 commit 6b0cf6a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/stash/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,18 @@ func FindSavedFilterIdsByFrontPage(ctx context.Context, client graphql.Client) (
for _, _filter := range frontPageFilters {
filter := _filter.(map[string]interface{})
typeName := filter["__typename"].(string)
if typeName == "CustomFilter" {
log.Ctx(ctx).Debug().Msg("Filter skipped: Predefined filter on front page: Only user created saved scene filters are supported.")
if typeName != "SavedFilter" {
log.Ctx(ctx).Debug().Str("type", typeName).Msg("Filter skipped: Unsupported filter type on front page: Only user created saved scene filters are supported.")
continue
}
fid := filter["savedFilterId"]
if typeName != "SavedFilter" || fid == nil {
log.Ctx(ctx).Debug().Str("type", typeName).Msg("Filter skipped: Filter of unsupported type on front page: Only user created saved scene filters are supported")
if fid == nil {
continue
}
filterId := strconv.Itoa(int(fid.(float64)))
filterId, ok := fid.(string)
if !ok {
filterId = strconv.Itoa(int(fid.(float64)))
}
filterIds = append(filterIds, filterId)
}

Expand Down

0 comments on commit 6b0cf6a

Please sign in to comment.