Fix url's from gallery scrapers (#4206)

* Fill in urls array when gallery scraper provides only single url
This commit is contained in:
Emilo2
2023-10-16 05:27:42 +03:00
committed by GitHub
parent 479e716385
commit 40bcb4baa5

View File

@@ -167,6 +167,14 @@ func (c Cache) postScrapeScene(ctx context.Context, scene ScrapedScene) (Scraped
} }
func (c Cache) postScrapeGallery(ctx context.Context, g ScrapedGallery) (ScrapedContent, error) { func (c Cache) postScrapeGallery(ctx context.Context, g ScrapedGallery) (ScrapedContent, error) {
// set the URL/URLs field
if g.URL == nil && len(g.URLs) > 0 {
g.URL = &g.URLs[0]
}
if g.URL != nil && len(g.URLs) == 0 {
g.URLs = []string{*g.URL}
}
if err := txn.WithReadTxn(ctx, c.txnManager, func(ctx context.Context) error { if err := txn.WithReadTxn(ctx, c.txnManager, func(ctx context.Context) error {
pqb := c.repository.PerformerFinder pqb := c.repository.PerformerFinder
tqb := c.repository.TagFinder tqb := c.repository.TagFinder