Skip to content
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

CSV import of single-valued property changes nil values to "[]" strings #1010

Open
aploshay opened this issue Jan 22, 2025 · 1 comment
Open

Comments

@aploshay
Copy link
Contributor

ApplicationMatcher#result changes nil values to a blank string, then calls #process_split which changes the blank string to an empty array, then (for a single-valued property) ultimately converts the empty array to a string value of "[]" via #single_metadata.

Line 25 of ApplicationMatcher note that nil values are transformed into empty strings, but then line 28 has a nil check that will always fail. Suggest adding after line 26 something to recapture lost nil values, such as:

          @result = nil if @result.blank?
@bkiahstroud
Copy link
Contributor

Hi @aploshay, thank you for reporting this issue!

This is a tricky one... I think we want @result to be an empty array [] for multi-valued properties (see f2c2652), so I think setting it back to nil might cause issues for those.

What do you think about making a change in #single_metadata instead? Maybe:

return unless content
return '' if content.to_s == '[]' # <-- addition
Array.wrap(content.to_s.strip).join('; ')

It isn't the most elegant solution so I'm open to suggestions, but I think it would get the job done

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

No branches or pull requests

2 participants