Skip to content

Commit

Permalink
Merge pull request #91 from val-krylov/batch-api-fix
Browse files Browse the repository at this point in the history
Fixed zombie objects creation in Batch API
  • Loading branch information
bk2204 authored Mar 19, 2020
2 parents bf4c40b + b79a22d commit bdfa657
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,21 @@ func (a *App) BatchHandler(w http.ResponseWriter, r *http.Request) {
}

// Object is not found
meta, err = a.metaStore.Put(object)
if err == nil {
responseObjects = append(responseObjects, a.Represent(object, meta, meta.Existing, true, useTus))
if bv.Operation == "upload" {
meta, err = a.metaStore.Put(object)
if err == nil {
responseObjects = append(responseObjects, a.Represent(object, meta, false, true, useTus))
}
} else {
rep := &Representation{
Oid: object.Oid,
Size: object.Size,
Error: &ObjectError{
Code: 404,
Message: "Not found",
},
}
responseObjects = append(responseObjects, rep)
}
}

Expand Down

0 comments on commit bdfa657

Please sign in to comment.