mirror of https://github.com/stashapp/stash.git
In performer scrapers, forward non-http single performer images (#4947)
* Forward non-http single performer images * Don't set if Images already set --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
parent
2d483f2d11
commit
4be60310c3
|
@ -125,7 +125,7 @@ type ScrapedPerformer struct {
|
|||
Aliases *string `json:"aliases"`
|
||||
Tags []*ScrapedTag `json:"tags"`
|
||||
// This should be a base64 encoded data URL
|
||||
Image *string `json:"image"`
|
||||
Image *string `json:"image"` // deprecated: use Images
|
||||
Images []string `json:"images"`
|
||||
Details *string `json:"details"`
|
||||
DeathDate *string `json:"death_date"`
|
||||
|
|
|
@ -12,11 +12,19 @@ import (
|
|||
)
|
||||
|
||||
func setPerformerImage(ctx context.Context, client *http.Client, p *models.ScrapedPerformer, globalConfig GlobalConfig) error {
|
||||
if p.Image == nil || !strings.HasPrefix(*p.Image, "http") {
|
||||
// backwards compatibility: we fetch the image if it's a URL and set it to the first image
|
||||
// Image is deprecated, so only do this if Images is unset
|
||||
if p.Image == nil || len(p.Images) > 0 {
|
||||
// nothing to do
|
||||
return nil
|
||||
}
|
||||
|
||||
// don't try to get the image if it doesn't appear to be a URL
|
||||
if !strings.HasPrefix(*p.Image, "http") {
|
||||
p.Images = []string{*p.Image}
|
||||
return nil
|
||||
}
|
||||
|
||||
img, err := getImage(ctx, *p.Image, client, globalConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue