From 40bcb4baa5e68065a6ed4f67bf86de1f7886d38a Mon Sep 17 00:00:00 2001 From: Emilo2 <99644577+Emilo2@users.noreply.github.com> Date: Mon, 16 Oct 2023 05:27:42 +0300 Subject: [PATCH] Fix url's from gallery scrapers (#4206) * Fill in urls array when gallery scraper provides only single url --- pkg/scraper/postprocessing.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/scraper/postprocessing.go b/pkg/scraper/postprocessing.go index e504e4d1c..17aadf730 100644 --- a/pkg/scraper/postprocessing.go +++ b/pkg/scraper/postprocessing.go @@ -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) { + // 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 { pqb := c.repository.PerformerFinder tqb := c.repository.TagFinder