Add debug logging and allow responsive aspect ratio for thumbnails
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m9s

This commit is contained in:
Elijah Kuntz 2026-06-11 11:53:30 -07:00
parent 939af551dc
commit e7a649d0d4
3 changed files with 15 additions and 3 deletions

View file

@ -335,16 +335,20 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
var results []OfficeFile
checksums := make(map[string]string)
rows, err := h.DB.Query("SELECT path, checksum FROM files WHERE checksum IS NOT NULL AND checksum != '' AND IFNULL(is_trashed, 0) = 0")
dbPaths := []string{}
rows, err := h.DB.Query("SELECT path, checksum FROM files WHERE checksum IS NOT NULL AND checksum != ''")
if err == nil {
defer rows.Close()
for rows.Next() {
var p, c string
if rows.Scan(&p, &c) == nil {
checksums[p] = c
dbPaths = append(dbPaths, p)
}
}
}
walkPaths := []string{}
filepath.Walk(h.Config.StorageDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
@ -362,12 +366,16 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
if strings.HasSuffix(strings.ToLower(info.Name()), ext) {
relPath, _ := filepath.Rel(h.Config.StorageDir, path)
relPathSlash := filepath.ToSlash(relPath)
chk := checksums[relPathSlash]
walkPaths = append(walkPaths, relPathSlash)
results = append(results, OfficeFile{
Name: info.Name(),
Path: relPathSlash,
Size: info.Size(),
ModTime: info.ModTime().UTC().Format("2006-01-02T15:04:05Z"),
Checksum: checksums[relPathSlash],
Checksum: chk,
})
}
return nil
@ -380,6 +388,8 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"files": results,
"count": len(results),
"debug_db": dbPaths,
"debug_walk": walkPaths,
})
}