fix(dump): do not export files which do not exist in storage
This commit is contained in:
parent
89e349f2fd
commit
77a779acea
@ -17,7 +17,9 @@
|
|||||||
package files
|
package files
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
|
gofs "io/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dump dumps all saved files
|
// 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))
|
allFiles = make(map[int64]io.ReadCloser, len(files))
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if err := file.LoadFileByID(); err != nil {
|
err = file.LoadFileByID()
|
||||||
return nil, err
|
if err != nil {
|
||||||
|
var pathError *gofs.PathError
|
||||||
|
if errors.As(err, &pathError) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
allFiles[file.ID] = file.File
|
allFiles[file.ID] = file.File
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user