mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +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.ApiKey = apiKey.String
|
||||||
f.Cookie = cookie.String
|
f.Cookie = cookie.String
|
||||||
|
|
||||||
|
if settings.Valid {
|
||||||
var settingsJson domain.FeedSettingsJSON
|
var settingsJson domain.FeedSettingsJSON
|
||||||
if err = json.Unmarshal([]byte(settings.String), &settingsJson); err != nil {
|
if err = json.Unmarshal([]byte(settings.String), &settingsJson); err != nil {
|
||||||
return nil, errors.Wrap(err, "error unmarshal settings")
|
return nil, errors.Wrap(err, "error unmarshal settings")
|
||||||
}
|
}
|
||||||
|
|
||||||
f.Settings = &settingsJson
|
f.Settings = &settingsJson
|
||||||
|
}
|
||||||
|
|
||||||
return &f, nil
|
return &f, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue