diff --git a/admin/api/sync.go b/admin/api/sync.go index a9ce8592..f9be0378 100644 --- a/admin/api/sync.go +++ b/admin/api/sync.go @@ -234,8 +234,30 @@ func autoSync(c *gin.Context) { } if theTheme == nil { - c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": fmt.Sprintf("Theme not found %q", p)}) - return + // The theme doesn't exists locally, perhaps it has not been imported already? + rThemes, err := sync.GetThemes(sync.GlobalImporter) + if err == nil { + for _, theme := range rThemes { + if theme == p { + sync.SyncThemes(sync.GlobalImporter) + + themes, err := fic.GetThemes() + if err == nil { + for _, theme := range themes { + if theme.Path == p { + theTheme = theme + break + } + } + } + } + } + } + + if theTheme == nil { + c.AbortWithStatusJSON(http.StatusNotFound, gin.H{"errmsg": fmt.Sprintf("Theme not found %q", p)}) + return + } } if !IsProductionEnv {