Fix: sidebar navigation from settings, missing thumbnails in all documents, and hiding upload buttons in office modes
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m16s

This commit is contained in:
Elijah 2026-05-25 16:14:52 -07:00
parent f9b0f515c5
commit ffa2954cd9
2 changed files with 30 additions and 15 deletions

View file

@ -302,14 +302,27 @@ func (h *OnlyOfficeHandler) ListOfficeFiles(c *fiber.Ctx) error {
}
type OfficeFile struct {
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
ModTime string `json:"mod_time"`
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
ModTime string `json:"mod_time"`
Checksum string `json:"checksum,omitempty"`
}
var results []OfficeFile
checksums := make(map[string]string)
rows, err := h.DB.Query("SELECT path, checksum FROM files WHERE checksum != '' AND is_trashed = 0")
if err == nil {
defer rows.Close()
for rows.Next() {
var p, c string
if rows.Scan(&p, &c) == nil {
checksums[p] = c
}
}
}
filepath.Walk(h.Config.StorageDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil
@ -325,11 +338,13 @@ 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)
results = append(results, OfficeFile{
Name: info.Name(),
Path: filepath.ToSlash(relPath),
Size: info.Size(),
ModTime: info.ModTime().UTC().Format("2006-01-02T15:04:05Z"),
Name: info.Name(),
Path: relPathSlash,
Size: info.Size(),
ModTime: info.ModTime().UTC().Format("2006-01-02T15:04:05Z"),
Checksum: checksums[relPathSlash],
})
}
return nil