0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-18 17:22:56 +02:00

Merge 34ad0a7fb7a4c6149bedf3b45e0feb2677d79c17 into 56eccb49954dbb561f4360481c3e52de92080f20

This commit is contained in:
FuXiaoHei 2025-07-11 13:51:13 +08:00 committed by GitHub
commit 4bea752997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@ import (
"fmt"
"hash"
"io"
"path"
"path/filepath"
"sort"
"strings"
@ -270,6 +271,22 @@ func mergeChunksForArtifact(ctx *ArtifactContext, chunks []*chunkFileItem, st st
for _, c := range chunks {
if err := st.Delete(c.Path); err != nil {
log.Warn("Error deleting chunk: %s, %v", c.Path, err)
} else {
log.Debug("Delete chunk:%s", c.Path)
}
}
dirName := path.Dir(chunks[0].Path)
existFiles := []string{}
st.IterateObjects(dirName, func(fpath string, obj storage.Object) error {
existFiles = append(existFiles, fpath)
return nil
})
log.Debug("Artifact temp chunks dir %s, files: %d", dirName, len(existFiles))
if len(existFiles) == 0 {
if err := st.Delete(dirName); err != nil {
log.Warn("Error deleting chunk dir: %s, %v", dirName, err)
} else {
log.Debug("Delete chunk dir:%s", dirName)
}
}
}()
@ -299,3 +316,7 @@ func mergeChunksForArtifact(ctx *ArtifactContext, chunks []*chunkFileItem, st st
return nil
}
func cleanStorageDirectory(dir string) {
}