Fix: include checksum in search results so thumbnails can be loaded in search view
All checks were successful
Automated Container Build / build-and-push (push) Successful in 59s

This commit is contained in:
Elijah 2026-05-25 19:51:04 -07:00
parent d7b0aa7074
commit 82731e93b1

View file

@ -963,7 +963,7 @@ func (h *FSHandler) Search(c *fiber.Ctx) error {
} }
rows, err := h.DB.Query(` rows, err := h.DB.Query(`
SELECT f.path, f.name, f.is_dir, f.size, f.mime_type, f.is_pinned SELECT f.path, f.name, f.is_dir, f.size, f.mime_type, f.is_pinned, f.checksum
FROM files f FROM files f
JOIN files_fts fts ON f.id = fts.rowid JOIN files_fts fts ON f.id = fts.rowid
WHERE files_fts MATCH ? AND f.is_trashed = 0 WHERE files_fts MATCH ? AND f.is_trashed = 0
@ -979,11 +979,13 @@ func (h *FSHandler) Search(c *fiber.Ctx) error {
for rows.Next() { for rows.Next() {
var fi FileInfo var fi FileInfo
var isDir, isPinned int var isDir, isPinned int
if err := rows.Scan(&fi.Path, &fi.Name, &isDir, &fi.Size, &fi.MimeType, &isPinned); err != nil { var checksum sql.NullString
if err := rows.Scan(&fi.Path, &fi.Name, &isDir, &fi.Size, &fi.MimeType, &isPinned, &checksum); err != nil {
continue continue
} }
fi.IsDir = isDir == 1 fi.IsDir = isDir == 1
fi.IsPinned = isPinned == 1 fi.IsPinned = isPinned == 1
fi.Checksum = checksum.String
results = append(results, fi) results = append(results, fi)
} }