Skip to content

Commit ad69f71

Browse files
authored
fix artifact merging chunks path with correct slash on Windows (#26400)
From Discord https://discord.com/channels/322538954119184384/1069795723178160168/1136719889684500480 Artifact chunks merging is break on Windows. ``` Gitea Log: 2023/08/03 20:51:15 ...actions/artifacts.go:271:comfirmUploadArtifact() [E] Error merge chunks: parse content range error: input does not match format ``` Artifact uses wrong slash to parse saved chunks path.
1 parent e6f8e93 commit ad69f71

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

routers/api/actions/artifacts_chunks.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"encoding/base64"
99
"fmt"
1010
"io"
11+
"path/filepath"
1112
"sort"
1213
"time"
1314

@@ -67,7 +68,7 @@ func listChunksByRunID(st storage.ObjectStorage, runID int64) (map[int64][]*chun
6768
var chunks []*chunkFileItem
6869
if err := st.IterateObjects(storageDir, func(path string, obj storage.Object) error {
6970
item := chunkFileItem{Path: path}
70-
if _, err := fmt.Sscanf(path, storageDir+"/%d-%d-%d.chunk", &item.ArtifactID, &item.Start, &item.End); err != nil {
71+
if _, err := fmt.Sscanf(path, filepath.Join(storageDir, "%d-%d-%d.chunk"), &item.ArtifactID, &item.Start, &item.End); err != nil {
7172
return fmt.Errorf("parse content range error: %v", err)
7273
}
7374
chunks = append(chunks, &item)

0 commit comments

Comments
 (0)