fix(backend): improve error handling in GetFileSliceList function to ignore non-existent directory errors

This commit is contained in:
keven1024
2025-12-21 21:17:36 +08:00
parent 90607aad7c
commit 185f7a3503

View File

@@ -31,7 +31,7 @@ func CreateFileSlice(fileId string, uploadPath string, fileSlice io.Reader, file
func GetFileSliceList(fileId string, uploadPath string) ([]int, error) {
slicesPath := filepath.Join(uploadPath, fmt.Sprintf("%s_%s", fileId, "tmp"))
files, err := os.ReadDir(slicesPath)
if err != nil {
if err != nil && !os.IsNotExist(err) {
return nil, fmt.Errorf("读取切片目录失败: %v", err)
}
fileSliceList := []int{}