diff --git a/pkg/api/resolver_mutation_performer.go b/pkg/api/resolver_mutation_performer.go index ab06dce10..65c089525 100644 --- a/pkg/api/resolver_mutation_performer.go +++ b/pkg/api/resolver_mutation_performer.go @@ -112,15 +112,18 @@ func (r *mutationResolver) PerformerUpdate(ctx context.Context, input models.Per UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()}, } if input.Image != nil { - checksum, imageData, err := utils.ProcessBase64Image(*input.Image) + _, imageData, err := utils.ProcessBase64Image(*input.Image) if err != nil { return nil, err } updatedPerformer.Image = imageData - updatedPerformer.Checksum = checksum } if input.Name != nil { + // generate checksum from performer name rather than image + checksum := utils.MD5FromString(*input.Name) + updatedPerformer.Name = sql.NullString{String: *input.Name, Valid: true} + updatedPerformer.Checksum = checksum } if input.URL != nil { updatedPerformer.URL = sql.NullString{String: *input.URL, Valid: true} diff --git a/pkg/api/resolver_mutation_studio.go b/pkg/api/resolver_mutation_studio.go index 26a26044d..1d07a809c 100644 --- a/pkg/api/resolver_mutation_studio.go +++ b/pkg/api/resolver_mutation_studio.go @@ -66,15 +66,17 @@ func (r *mutationResolver) StudioUpdate(ctx context.Context, input models.Studio UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()}, } if input.Image != nil { - checksum, imageData, err := utils.ProcessBase64Image(*input.Image) + _, imageData, err := utils.ProcessBase64Image(*input.Image) if err != nil { return nil, err } updatedStudio.Image = imageData - updatedStudio.Checksum = checksum } if input.Name != nil { + // generate checksum from studio name rather than image + checksum := utils.MD5FromString(*input.Name) updatedStudio.Name = sql.NullString{String: *input.Name, Valid: true} + updatedStudio.Checksum = checksum } if input.URL != nil { updatedStudio.URL = sql.NullString{String: *input.URL, Valid: true} diff --git a/pkg/manager/task_import.go b/pkg/manager/task_import.go index 398968ce2..29bc68ff4 100644 --- a/pkg/manager/task_import.go +++ b/pkg/manager/task_import.go @@ -64,8 +64,11 @@ func (t *ImportTask) ImportPerformers(ctx context.Context) { logger.Progressf("[performers] %d of %d", index, len(t.Mappings.Performers)) + // generate checksum from performer name rather than image + checksum := utils.MD5FromString(performerJSON.Name) + // Process the base 64 encoded image string - checksum, imageData, err := utils.ProcessBase64Image(performerJSON.Image) + _, imageData, err := utils.ProcessBase64Image(performerJSON.Image) if err != nil { _ = tx.Rollback() logger.Errorf("[performers] <%s> invalid image: %s", mappingJSON.Checksum, err.Error()) @@ -159,8 +162,11 @@ func (t *ImportTask) ImportStudios(ctx context.Context) { logger.Progressf("[studios] %d of %d", index, len(t.Mappings.Studios)) + // generate checksum from studio name rather than image + checksum := utils.MD5FromString(studioJSON.Name) + // Process the base 64 encoded image string - checksum, imageData, err := utils.ProcessBase64Image(studioJSON.Image) + _, imageData, err := utils.ProcessBase64Image(studioJSON.Image) if err != nil { _ = tx.Rollback() logger.Errorf("[studios] <%s> invalid image: %s", mappingJSON.Checksum, err.Error())