Daniel 2025-07-09 20:35:52 +08:00
parent 31f5797176
commit 9933cd98ec
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 12 additions and 1 deletions

View file

@ -201,7 +201,10 @@ func fillAttributeViewGalleryCardCover(attrView *av.AttributeView, view *av.View
break break
} }
galleryCard.CoverURL = assetValue.MAsset[0].Content p := assetValue.MAsset[0].Content
if util.IsAssetsImage(p) {
galleryCard.CoverURL = p
}
return return
case av.CoverFromContentBlock: case av.CoverFromContentBlock:
blockValue := getBlockValue(cardValues) blockValue := getBlockValue(cardValues)

View file

@ -317,6 +317,14 @@ var (
SiYuanAssetsVideo = []string{".mov", ".weba", ".mkv", ".mp4", ".webm"} 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 { func IsDisplayableAsset(p string) bool {
ext := strings.ToLower(filepath.Ext(p)) ext := strings.ToLower(filepath.Ext(p))
if "" == ext { if "" == ext {