mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(coderd): avoid fetching extra parameters for a preset (#16642)
This pull request fixes a bug in presets and adds tests to ensure it
doesn't happen again.
Due to an oversight in refactoring, we returned extra and incorrect
parameters from other presets in the same template version when calling
`/templateversions/{templateversion}/presets`.
This commit is contained in:
@@ -45,6 +45,10 @@ func (api *API) templateVersionPresets(rw http.ResponseWriter, r *http.Request)
|
||||
Name: preset.Name,
|
||||
}
|
||||
for _, presetParam := range presetParams {
|
||||
if presetParam.TemplateVersionPresetID != preset.ID {
|
||||
continue
|
||||
}
|
||||
|
||||
sdkPreset.Parameters = append(sdkPreset.Parameters, codersdk.PresetParameter{
|
||||
Name: presetParam.Name,
|
||||
Value: presetParam.Value,
|
||||
|
||||
Reference in New Issue
Block a user