fix: artifact v4 upload above 8MB (#2402)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
@@ -271,6 +271,16 @@ func (r *artifactV4Routes) createArtifact(ctx *ArtifactContext) {
|
||||
|
||||
artifactName := req.Name
|
||||
|
||||
safeRunPath := safeResolve(r.baseDir, fmt.Sprint(runID))
|
||||
safePath := safeResolve(safeRunPath, artifactName)
|
||||
safePath = safeResolve(safePath, artifactName+".zip")
|
||||
file, err := r.fs.OpenWritable(safePath)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
file.Close()
|
||||
|
||||
respData := CreateArtifactResponse{
|
||||
Ok: true,
|
||||
SignedUploadUrl: r.buildArtifactURL("UploadArtifact", artifactName, runID),
|
||||
@@ -292,12 +302,7 @@ func (r *artifactV4Routes) uploadArtifact(ctx *ArtifactContext) {
|
||||
safePath := safeResolve(safeRunPath, artifactName)
|
||||
safePath = safeResolve(safePath, artifactName+".zip")
|
||||
|
||||
file, err := func() (WritableFile, error) {
|
||||
if comp == "appendBlock" {
|
||||
return r.fs.OpenAppendable(safePath)
|
||||
}
|
||||
return r.fs.OpenWritable(safePath)
|
||||
}()
|
||||
file, err := r.fs.OpenAppendable(safePath)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -317,6 +322,7 @@ func (r *artifactV4Routes) uploadArtifact(ctx *ArtifactContext) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
file.Close()
|
||||
ctx.JSON(http.StatusCreated, "appended")
|
||||
case "blocklist":
|
||||
ctx.JSON(http.StatusCreated, "created")
|
||||
|
||||
Reference in New Issue
Block a user