mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(feeds): check settings before unmarshalling (#789)
This commit is contained in:
parent
fe2950f630
commit
b6062ffc60
1 changed files with 7 additions and 5 deletions
|
@ -68,12 +68,14 @@ func (r *FeedRepo) FindByID(ctx context.Context, id int) (*domain.Feed, error) {
|
|||
f.ApiKey = apiKey.String
|
||||
f.Cookie = cookie.String
|
||||
|
||||
var settingsJson domain.FeedSettingsJSON
|
||||
if err = json.Unmarshal([]byte(settings.String), &settingsJson); err != nil {
|
||||
return nil, errors.Wrap(err, "error unmarshal settings")
|
||||
}
|
||||
if settings.Valid {
|
||||
var settingsJson domain.FeedSettingsJSON
|
||||
if err = json.Unmarshal([]byte(settings.String), &settingsJson); err != nil {
|
||||
return nil, errors.Wrap(err, "error unmarshal settings")
|
||||
}
|
||||
|
||||
f.Settings = &settingsJson
|
||||
f.Settings = &settingsJson
|
||||
}
|
||||
|
||||
return &f, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue