fix(dump): do not export files which do not exist in storage

This commit is contained in:
kolaente 2024-02-13 21:14:31 +01:00
parent 89e349f2fd
commit 77a779acea
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -17,7 +17,9 @@
package files
import (
"errors"
"io"
gofs "io/fs"
)
// Dump dumps all saved files
@ -31,8 +33,13 @@ func Dump() (allFiles map[int64]io.ReadCloser, err error) {
allFiles = make(map[int64]io.ReadCloser, len(files))
for _, file := range files {
if err := file.LoadFileByID(); err != nil {
return nil, err
err = file.LoadFileByID()
if err != nil {
var pathError *gofs.PathError
if errors.As(err, &pathError) {
continue
}
return
}
allFiles[file.ID] = file.File
}