Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15240

Daniel9933cd98ecfe
diff --git a/kernel/sql/av_gallery.go b/kernel/sql/av_gallery.go
index ac58869074..4d61ddbe82 100644
--- a/kernel/sql/av_gallery.go
+++ b/kernel/sql/av_gallery.go
@@ -201,7 +201,10 @@ func fillAttributeViewGalleryCardCover(attrView *av.AttributeView, view *av.View
break
}
- galleryCard.CoverURL = assetValue.MAsset[0].Content
+ p := assetValue.MAsset[0].Content
+ if util.IsAssetsImage(p) {
+ galleryCard.CoverURL = p
+ }
return
case av.CoverFromContentBlock:
blockValue := getBlockValue(cardValues)
diff --git a/kernel/util/path.go b/kernel/util/path.go
index 995cd03e69..d651dc829e 100644
--- a/kernel/util/path.go
+++ b/kernel/util/path.go
@@ -317,6 +317,14 @@ var (
SiYuanAssetsVideo = []string{".mov", ".weba", ".mkv", ".mp4", ".webm"}
)
+func IsAssetsImage(p string) bool {
+ ext := strings.ToLower(filepath.Ext(p))
+ if "" == ext {
+ return false
+ }
+ return gulu.Str.Contains(ext, SiYuanAssetsImage)
+}
+
func IsDisplayableAsset(p string) bool {
ext := strings.ToLower(filepath.Ext(p))
if "" == ext {