-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed zombie objects creation in Batch API #91
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here, we don't use |
||
} | ||
} else { | ||
rep := &Representation{ | ||
Oid: object.Oid, | ||
Size: object.Size, | ||
Error: &ObjectError{ | ||
Code: 404, | ||
Message: "Not found", | ||
}, | ||
} | ||
responseObjects = append(responseObjects, rep) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To annotate this for future readers, what's going on here is that if the object is not found, we currently store a stub entry and return an upload response. However, if we're attempting to download, there's no reason to create a stub, since the user didn't request that, and so we should produce a 404 response for this object instead.
Because the
Put
method returnsmeta.Existing
set to true here, we produce both a download and an upload.