mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Fix gallery checksum resolver error (#2929)
This commit is contained in:
parent
8efbcc1c4d
commit
98e3610ade
7 changed files with 20 additions and 7 deletions
|
|
@ -177,6 +177,18 @@ func (r *galleryResolver) Date(ctx context.Context, obj *models.Gallery) (*strin
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *galleryResolver) Checksum(ctx context.Context, obj *models.Gallery) (string, error) {
|
||||||
|
if !obj.Files.PrimaryLoaded() {
|
||||||
|
if err := r.withTxn(ctx, func(ctx context.Context) error {
|
||||||
|
return obj.LoadPrimaryFile(ctx, r.repository.File)
|
||||||
|
}); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj.PrimaryChecksum(), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *galleryResolver) Scenes(ctx context.Context, obj *models.Gallery) (ret []*models.Scene, err error) {
|
func (r *galleryResolver) Scenes(ctx context.Context, obj *models.Gallery) (ret []*models.Scene, err error) {
|
||||||
if !obj.SceneIDs.Loaded() {
|
if !obj.SceneIDs.Loaded() {
|
||||||
if err := r.withTxn(ctx, func(ctx context.Context) error {
|
if err := r.withTxn(ctx, func(ctx context.Context) error {
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ func (r *mutationResolver) GalleryDestroy(ctx context.Context, input models.Gall
|
||||||
for _, gallery := range galleries {
|
for _, gallery := range galleries {
|
||||||
r.hookExecutor.ExecutePostHooks(ctx, gallery.ID, plugin.GalleryDestroyPost, plugin.GalleryDestroyInput{
|
r.hookExecutor.ExecutePostHooks(ctx, gallery.ID, plugin.GalleryDestroyPost, plugin.GalleryDestroyInput{
|
||||||
GalleryDestroyInput: input,
|
GalleryDestroyInput: input,
|
||||||
Checksum: gallery.Checksum(),
|
Checksum: gallery.PrimaryChecksum(),
|
||||||
Path: gallery.Path,
|
Path: gallery.Path,
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ func (h *cleanHandler) handleRelatedGalleries(ctx context.Context, fileID file.I
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr.PluginCache.RegisterPostHooks(ctx, g.ID, plugin.GalleryDestroyPost, plugin.GalleryDestroyInput{
|
mgr.PluginCache.RegisterPostHooks(ctx, g.ID, plugin.GalleryDestroyPost, plugin.GalleryDestroyInput{
|
||||||
Checksum: g.Checksum(),
|
Checksum: g.PrimaryChecksum(),
|
||||||
Path: g.Path,
|
Path: g.Path,
|
||||||
}, nil)
|
}, nil)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ func (t *ExportTask) populateGalleryImages(ctx context.Context, repo Repository)
|
||||||
|
|
||||||
images, err := imageReader.FindByGalleryID(ctx, g.ID)
|
images, err := imageReader.FindByGalleryID(ctx, g.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("[galleries] <%s> failed to fetch images for gallery: %s", g.Checksum(), err.Error())
|
logger.Errorf("[galleries] <%s> failed to fetch images for gallery: %s", g.PrimaryChecksum(), err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -765,7 +765,7 @@ func exportGallery(ctx context.Context, wg *sync.WaitGroup, jobChan <-chan *mode
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
galleryHash := g.Checksum()
|
galleryHash := g.PrimaryChecksum()
|
||||||
|
|
||||||
newGalleryJSON, err := gallery.ToBasicJSON(g)
|
newGalleryJSON, err := gallery.ToBasicJSON(g)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ func (g *Gallery) LoadTagIDs(ctx context.Context, l TagIDLoader) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g Gallery) Checksum() string {
|
func (g Gallery) PrimaryChecksum() string {
|
||||||
|
// renamed from Checksum to prevent gqlgen from using it in the resolver
|
||||||
if p := g.Files.Primary(); p != nil {
|
if p := g.Files.Primary(); p != nil {
|
||||||
v := p.Base().Fingerprints.Get(file.FingerprintTypeMD5)
|
v := p.Base().Fingerprints.Get(file.FingerprintTypeMD5)
|
||||||
if v == nil {
|
if v == nil {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ func queryURLParameterFromURL(url string) queryURLParameters {
|
||||||
|
|
||||||
func queryURLParametersFromGallery(gallery *models.Gallery) queryURLParameters {
|
func queryURLParametersFromGallery(gallery *models.Gallery) queryURLParameters {
|
||||||
ret := make(queryURLParameters)
|
ret := make(queryURLParameters)
|
||||||
ret["checksum"] = gallery.Checksum()
|
ret["checksum"] = gallery.PrimaryChecksum()
|
||||||
|
|
||||||
if gallery.Path != "" {
|
if gallery.Path != "" {
|
||||||
ret["filename"] = filepath.Base(gallery.Path)
|
ret["filename"] = filepath.Base(gallery.Path)
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ func (s *stashScraper) scrapeGalleryByGallery(ctx context.Context, gallery *mode
|
||||||
Checksum *string `graphql:"checksum" json:"checksum"`
|
Checksum *string `graphql:"checksum" json:"checksum"`
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum := gallery.Checksum()
|
checksum := gallery.PrimaryChecksum()
|
||||||
input := GalleryHashInput{
|
input := GalleryHashInput{
|
||||||
Checksum: &checksum,
|
Checksum: &checksum,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue