Skip to content

Fix CreateSnapshotPolicy handling of indices array format#1353

Open
sandervandegeijn wants to merge 1 commit into
opensearch-project:mainfrom
sandervandegeijn:fix-snapshot-policy-indices-array-format
Open

Fix CreateSnapshotPolicy handling of indices array format#1353
sandervandegeijn wants to merge 1 commit into
opensearch-project:mainfrom
sandervandegeijn:fix-snapshot-policy-indices-array-format

Conversation

@sandervandegeijn

@sandervandegeijn sandervandegeijn commented Sep 10, 2025

Copy link
Copy Markdown

The CreateSnapshotPolicy component was failing when the API returned indices as an array instead of a string, causing TypeError: indices.split is not a function. The API permits both a string and array, I was using the array. Another fix could be to make the API more restrictive but that might impact users who have done the same and actually I like the array better than a delimited string.

So, frontend fix with Claude Code to permit this. Tests succeed locally.

Changes:

  • Updated getPolicy method to handle both array and string formats for indices
  • Added comprehensive unit tests to prevent regression
  • Maintains backward compatibility with existing string format

Fixes issue where editing snapshot policies would fail with TypeError when indices were returned as an array from the API.

Description

Fixed the loading error

Issues Resolved

#946

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

The CreateSnapshotPolicy component was failing when the API returned
indices as an array instead of a string, causing TypeError: indices.split
is not a function.

Changes:
- Updated getPolicy method to handle both array and string formats for indices
- Added comprehensive unit tests to prevent regression
- Maintains backward compatibility with existing string format

Fixes issue where editing snapshot policies would fail with TypeError
when indices were returned as an array from the API.

Signed-off-by: Sander van de Geijn <sandervandegeijn@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant