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
All checks were successful
Automated Container Build / build-and-push (push) Successful in 59s
This commit is contained in:
parent
d7b0aa7074
commit
82731e93b1
1 changed files with 4 additions and 2 deletions
|
|
@ -963,7 +963,7 @@ func (h *FSHandler) Search(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
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
|
||||
JOIN files_fts fts ON f.id = fts.rowid
|
||||
WHERE files_fts MATCH ? AND f.is_trashed = 0
|
||||
|
|
@ -979,11 +979,13 @@ func (h *FSHandler) Search(c *fiber.Ctx) error {
|
|||
for rows.Next() {
|
||||
var fi FileInfo
|
||||
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
|
||||
}
|
||||
fi.IsDir = isDir == 1
|
||||
fi.IsPinned = isPinned == 1
|
||||
fi.Checksum = checksum.String
|
||||
results = append(results, fi)
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue