Improve the image loading performance in the database https://github.com/siyuan-note/siyuan/issues/15245

This commit is contained in:
Daniel 2025-07-09 16:18:53 +08:00
parent 9bb91c3a97
commit c852f6f51a
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
8 changed files with 113 additions and 8 deletions

View file

@ -300,6 +300,12 @@ func IsSubPath(absPath, toCheckPath string) bool {
return false
}
func IsCompressibleAssetImage(p string) bool {
lowerName := strings.ToLower(p)
return strings.HasPrefix(lowerName, "assets/") &&
(strings.HasSuffix(lowerName, ".png") || strings.HasSuffix(lowerName, ".jpg") || strings.HasSuffix(lowerName, ".jpeg"))
}
func SizeOfDirectory(path string) (size int64, err error) {
err = filelock.Walk(path, func(path string, d fs.DirEntry, err error) error {
if err != nil {