fix(ui): 'undefined' being used for metadata on uploaded images (#6433)

## Summary

TIL if you add `undefined` to a form data object, it gets stringified to
`'undefined'`. Whoops!

## Related Issues / Discussions

n/a

## QA Instructions

n/a

## Merge Plan

n/a

## Checklist

- [x] _The PR has a short but descriptive title, suitable for a
changelog_
- [ ] _Tests added / updated (if applicable)_
- [ ] _Documentation added / updated (if applicable)_
This commit is contained in:
blessedcoolant 2024-05-24 03:14:02 +05:30 committed by GitHub
commit c493628272
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -576,7 +576,9 @@ export const imagesApi = api.injectEndpoints({
query: ({ file, image_category, is_intermediate, session_id, board_id, crop_visible, metadata }) => {
const formData = new FormData();
formData.append('file', file);
formData.append('metadata', JSON.stringify(metadata));
if (metadata) {
formData.append('metadata', JSON.stringify(metadata));
}
return {
url: buildImagesUrl('upload'),
method: 'POST',