Fox files not showing thumbnails in all documents section
All checks were successful
Automated Container Build / build-and-push (push) Successful in 58s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 58s
This commit is contained in:
parent
c9e078586f
commit
83e73b4d52
3 changed files with 44 additions and 1 deletions
|
|
@ -362,12 +362,30 @@ 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]
|
||||
if chk == "" {
|
||||
// Fallback: the path in the database might have a different prefix format
|
||||
// (e.g. "/test.docx", "./test.docx") or different casing.
|
||||
cleanRel := filepath.ToSlash(filepath.Clean(relPathSlash))
|
||||
cleanRel = strings.TrimPrefix(cleanRel, "/")
|
||||
|
||||
for k, v := range checksums {
|
||||
cleanK := filepath.ToSlash(filepath.Clean(k))
|
||||
cleanK = strings.TrimPrefix(cleanK, "/")
|
||||
if strings.EqualFold(cleanK, cleanRel) {
|
||||
chk = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
|||
Reference in a new issue