mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Fix checksum during studio/performer update
This commit is contained in:
@@ -111,15 +111,18 @@ func (r *mutationResolver) PerformerUpdate(ctx context.Context, input models.Per
|
|||||||
UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()},
|
UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()},
|
||||||
}
|
}
|
||||||
if input.Image != nil {
|
if input.Image != nil {
|
||||||
checksum, imageData, err := utils.ProcessBase64Image(*input.Image)
|
_, imageData, err := utils.ProcessBase64Image(*input.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
updatedPerformer.Image = imageData
|
updatedPerformer.Image = imageData
|
||||||
updatedPerformer.Checksum = checksum
|
|
||||||
}
|
}
|
||||||
if input.Name != nil {
|
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.Name = sql.NullString{String: *input.Name, Valid: true}
|
||||||
|
updatedPerformer.Checksum = checksum
|
||||||
}
|
}
|
||||||
if input.URL != nil {
|
if input.URL != nil {
|
||||||
updatedPerformer.URL = sql.NullString{String: *input.URL, Valid: true}
|
updatedPerformer.URL = sql.NullString{String: *input.URL, Valid: true}
|
||||||
|
|||||||
@@ -66,15 +66,17 @@ func (r *mutationResolver) StudioUpdate(ctx context.Context, input models.Studio
|
|||||||
UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()},
|
UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()},
|
||||||
}
|
}
|
||||||
if input.Image != nil {
|
if input.Image != nil {
|
||||||
checksum, imageData, err := utils.ProcessBase64Image(*input.Image)
|
_, imageData, err := utils.ProcessBase64Image(*input.Image)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
updatedStudio.Image = imageData
|
updatedStudio.Image = imageData
|
||||||
updatedStudio.Checksum = checksum
|
|
||||||
}
|
}
|
||||||
if input.Name != nil {
|
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.Name = sql.NullString{String: *input.Name, Valid: true}
|
||||||
|
updatedStudio.Checksum = checksum
|
||||||
}
|
}
|
||||||
if input.URL != nil {
|
if input.URL != nil {
|
||||||
updatedStudio.URL = sql.NullString{String: *input.URL, Valid: true}
|
updatedStudio.URL = sql.NullString{String: *input.URL, Valid: true}
|
||||||
|
|||||||
Reference in New Issue
Block a user