Provisioning: Include ref field in DELETE endpoint response for branch operations (#113615)

Fix: Include ref field in DELETE endpoint response for branch operations

When deleting a dashboard file via DELETE endpoint with a ref query parameter
(for branch operations), the response was missing the ref field. This caused
the frontend branch workflow success handler to fail silently.

The issue was an inverted boolean condition in the Delete method. The code
was setting file.Ref = opts.Ref when shouldUpdateGrafanaDB returned true
(main branch operations), but it should have been setting it when false
(branch operations), since we read the file with an empty ref.

Fixed by inverting the condition from:
  if r.shouldUpdateGrafanaDB(opts, nil)
to:
  if !r.shouldUpdateGrafanaDB(opts, nil)

This ensures the ref field is properly included in the ResourceWrapper
response for branch operations.
This commit is contained in:
Roberto Jiménez Sánchez
2025-11-10 13:34:46 +01:00
committed by GitHub
parent 32db7e176d
commit 746efb4c56
@@ -100,7 +100,7 @@ func (r *DualReadWriter) Delete(ctx context.Context, opts DualWriteOptions) (*Pa
}
// HACK: manual set to the provided branch so that the parser can possible read the file
if r.shouldUpdateGrafanaDB(opts, nil) {
if !r.shouldUpdateGrafanaDB(opts, nil) {
file.Ref = opts.Ref
}