sync: Don't overwrite theme image if it exists

This commit is contained in:
nemunaire 2024-03-24 20:17:25 +01:00
parent 9e6a03c681
commit f4d0e0001c
1 changed files with 8 additions and 3 deletions

View File

@ -400,10 +400,15 @@ func SyncExercice(i Importer, theme *fic.Theme, epath string, dmap *map[int64]*f
e.BackgroundColor, _ = getBackgroundColor(filePath)
// If the theme has no image yet, use the first exercice's image found
theme.Image = e.Image
_, err := theme.Update()
if theme != nil && theme.Image == "" {
theme.Image = e.Image
_, err := theme.Update()
if err != nil {
return nil, err
}
}
return nil, err
return nil, nil
}); err != nil {
errs = multierr.Append(errs, NewExerciceError(e, fmt.Errorf("unable to import heading image: %w", err)))
}