-
Notifications
You must be signed in to change notification settings - Fork 64
fix: add missing keys field in prefop result items #178
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
base: master
Are you sure you want to change the base?
Conversation
When a prefop operation (e.g., vsample) generates multiple files, the HTTP response body includes an items[].keys field that was not being parsed or returned in PrefopRet.Items.Keys. This commit fixes the issue by: 1. Adding Keys field to PfopTaskItem struct in media/apis/prefop/api.go 2. Adding corresponding JSON marshaling/unmarshaling support 3. Updating storage/pfop.go Prefop() method to copy Keys from API response Fixes #177 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: nighca <[email protected]>
|
Hi @xgopilot[bot]. Thanks for your PR. I'm waiting for a qiniu member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Code Review CompleteI've reviewed the changes in PR #178 that add support for the Review SummaryFiles Changed:
Issues Found1. Validation Logic Inconsistency (media/apis/prefop/api.go:76-96)The func (j *PfopTaskItem) validate() error {
if j.Command == "" {
return errors.MissingRequiredFieldError{Name: "Command"}
}
if j.Code == 0 {
return errors.MissingRequiredFieldError{Name: "Code"}
}
if j.Description == "" {
return errors.MissingRequiredFieldError{Name: "Description"}
}
if j.Hash == "" {
return errors.MissingRequiredFieldError{Name: "Hash"}
}
if j.ObjectName == "" {
return errors.MissingRequiredFieldError{Name: "ObjectName"}
}
if j.ReturnOld == 0 {
return errors.MissingRequiredFieldError{Name: "ReturnOld"}
}
return nil
}Problem: The validation enforces that
Note: This issue exists in the current codebase and is not introduced by this PR. However, it may affect the usability of the new 2. Missing Keys Field ValidationWhile the new Verification Needed
Positive Aspects
👉 Want me to re-run this review? Just type |
|
@YangSen-qn 帮 review 下这个 PR? |
Requested by @nighca
This PR fixes issue #177 where the
keysfield in prefop result items was not being correctly returned.Summary
When a prefop operation (e.g.,
vsample) generates multiple files, the HTTP response body includes anitems[].keysfield that was not being parsed or returned inPrefopRet.Items.Keys.Changes
media/apis/prefop/api.go:
Keys []stringfield toPfopTaskItemstruct"keys,omitempty"tojsonPfopTaskItemstructMarshalJSON()method to includeKeysfieldUnmarshalJSON()method to populateKeysfield from JSON responsestorage/pfop.go:
Prefop()method to copyKeysfield from API response to the returnedFopResultTesting
The fix ensures that when the Qiniu API returns multiple file keys in the prefop response, they are now properly captured in the
PrefopRet.Items[].Keysfield.Fixes #177