Skip to content

Commit

Permalink
fix artifact merging chunks path with correct slash on Windows (go-gi…
Browse files Browse the repository at this point in the history
…tea#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.
  • Loading branch information
fuxiaohei authored Aug 8, 2023
1 parent e6f8e93 commit ad69f71
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routers/api/actions/artifacts_chunks.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/base64"
"fmt"
"io"
"path/filepath"
"sort"
"time"

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

0 comments on commit ad69f71

Please sign in to comment.