1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

fix(googlereader): avoid panic for inexisting feed or category

This commit is contained in:
Frédéric Guillot 2025-05-02 17:30:34 -07:00
parent 81c7669945
commit 63f0a17388
2 changed files with 14 additions and 1 deletions

View file

@ -800,10 +800,15 @@ func rename(stream Stream, title string, store *storage.Storage, userID int64) e
if title == "" {
return errors.New("empty title")
}
feed, err := getFeed(stream, store, userID)
if err != nil {
return err
}
if feed == nil {
return errors.New("feed not found")
}
feedModification := model.FeedModificationRequest{
Title: &title,
}
@ -816,10 +821,18 @@ func move(stream Stream, destination Stream, store *storage.Storage, userID int6
if err != nil {
return err
}
if feed == nil {
return errors.New("feed not found")
}
category, err := getOrCreateCategory(destination, store, userID)
if err != nil {
return err
}
if category == nil {
return errors.New("category not found or unable to create category")
}
feedModification := model.FeedModificationRequest{
CategoryID: &category.ID,
}

View file

@ -192,7 +192,7 @@ func (s *Storage) CreateCategory(userID int64, request *model.CategoryCreationRe
)
if err != nil {
return nil, fmt.Errorf(`store: unable to create category %q: %v`, request.Title, err)
return nil, fmt.Errorf(`store: unable to create category %q for user ID %d: %v`, request.Title, userID, err)
}
return &category, nil