mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix identify and script scraper bugs (#2375)
* Continue identify if source fails * Handle empty result set correctly * Parse null values from scraper script correctly * Omit warning when json selector value missing * Return nil when scraped item not found * Fix graphql validation errors
This commit is contained in:
@@ -273,10 +273,16 @@ func (c Cache) ScrapeID(ctx context.Context, scraperID string, id int, ty models
|
||||
return nil, fmt.Errorf("scraper %s: unable to load scene id %v: %w", scraperID, id, err)
|
||||
}
|
||||
|
||||
ret, err = ss.viaScene(ctx, c.client, scene)
|
||||
// don't assign nil concrete pointer to ret interface, otherwise nil
|
||||
// detection is harder
|
||||
scraped, err := ss.viaScene(ctx, c.client, scene)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("scraper %s: %w", scraperID, err)
|
||||
}
|
||||
|
||||
if scraped != nil {
|
||||
ret = scraped
|
||||
}
|
||||
case models.ScrapeContentTypeGallery:
|
||||
gs, ok := s.(galleryScraper)
|
||||
if !ok {
|
||||
@@ -288,10 +294,16 @@ func (c Cache) ScrapeID(ctx context.Context, scraperID string, id int, ty models
|
||||
return nil, fmt.Errorf("scraper %s: unable to load gallery id %v: %w", scraperID, id, err)
|
||||
}
|
||||
|
||||
ret, err = gs.viaGallery(ctx, c.client, gallery)
|
||||
// don't assign nil concrete pointer to ret interface, otherwise nil
|
||||
// detection is harder
|
||||
scraped, err := gs.viaGallery(ctx, c.client, gallery)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("scraper %s: %w", scraperID, err)
|
||||
}
|
||||
|
||||
if scraped != nil {
|
||||
ret = scraped
|
||||
}
|
||||
}
|
||||
|
||||
return c.postScrape(ctx, ret)
|
||||
|
||||
Reference in New Issue
Block a user