Parcourir la source

:art: 集市已下载包在配置文件不正确的情况下不应该显示更新按钮 https://github.com/siyuan-note/siyuan/issues/5838

Liang Ding il y a 2 ans
Parent
commit
215c70db23
1 fichiers modifiés avec 24 ajouts et 0 suppressions
  1. 24 0
      kernel/bazaar/package.go

+ 24 - 0
kernel/bazaar/package.go

@@ -180,6 +180,12 @@ func isOutdatedTheme(theme *Theme, bazaarThemes []*Theme) bool {
 		return false
 		return false
 	}
 	}
 
 
+	repo := strings.TrimPrefix(theme.URL, "https://github.com/")
+	parts := strings.Split(repo, "/")
+	if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
+		return false
+	}
+
 	for _, pkg := range bazaarThemes {
 	for _, pkg := range bazaarThemes {
 		if theme.URL == pkg.URL && theme.Name == pkg.Name && theme.Author == pkg.Author && theme.Version != pkg.Version {
 		if theme.URL == pkg.URL && theme.Name == pkg.Name && theme.Author == pkg.Author && theme.Version != pkg.Version {
 			theme.RepoHash = pkg.RepoHash
 			theme.RepoHash = pkg.RepoHash
@@ -194,6 +200,12 @@ func isOutdatedIcon(icon *Icon, bazaarIcons []*Icon) bool {
 		return false
 		return false
 	}
 	}
 
 
+	repo := strings.TrimPrefix(icon.URL, "https://github.com/")
+	parts := strings.Split(repo, "/")
+	if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
+		return false
+	}
+
 	for _, pkg := range bazaarIcons {
 	for _, pkg := range bazaarIcons {
 		if icon.URL == pkg.URL && icon.Name == pkg.Name && icon.Author == pkg.Author && icon.Version != pkg.Version {
 		if icon.URL == pkg.URL && icon.Name == pkg.Name && icon.Author == pkg.Author && icon.Version != pkg.Version {
 			icon.RepoHash = pkg.RepoHash
 			icon.RepoHash = pkg.RepoHash
@@ -208,6 +220,12 @@ func isOutdatedWidget(widget *Widget, bazaarWidgets []*Widget) bool {
 		return false
 		return false
 	}
 	}
 
 
+	repo := strings.TrimPrefix(widget.URL, "https://github.com/")
+	parts := strings.Split(repo, "/")
+	if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
+		return false
+	}
+
 	for _, pkg := range bazaarWidgets {
 	for _, pkg := range bazaarWidgets {
 		if widget.URL == pkg.URL && widget.Name == pkg.Name && widget.Author == pkg.Author && widget.Version != pkg.Version {
 		if widget.URL == pkg.URL && widget.Name == pkg.Name && widget.Author == pkg.Author && widget.Version != pkg.Version {
 			widget.RepoHash = pkg.RepoHash
 			widget.RepoHash = pkg.RepoHash
@@ -222,6 +240,12 @@ func isOutdatedTemplate(template *Template, bazaarTemplates []*Template) bool {
 		return false
 		return false
 	}
 	}
 
 
+	repo := strings.TrimPrefix(template.URL, "https://github.com/")
+	parts := strings.Split(repo, "/")
+	if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
+		return false
+	}
+
 	for _, pkg := range bazaarTemplates {
 	for _, pkg := range bazaarTemplates {
 		if template.URL == pkg.URL && template.Name == pkg.Name && template.Author == pkg.Author && template.Version != pkg.Version {
 		if template.URL == pkg.URL && template.Name == pkg.Name && template.Author == pkg.Author && template.Version != pkg.Version {
 			template.RepoHash = pkg.RepoHash
 			template.RepoHash = pkg.RepoHash