-
Notifications
You must be signed in to change notification settings - Fork 488
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
#8193 strip commas from email response #8343
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to approve this because I think it'll allow guestbooks to be downloaded.
However, in the example by @jggautier in the issue, he was entering juliangautier@g.harvard.edu,in
As of this code I expect it to become juliangautier@g.harvard.eduin
I guess this is better? In either case, the ,in
doesn't make sense to me. I don't know why it's there.
In a future pull request, perhaps we should add some input validation so that juliangautier@g.harvard.edu,in
isn't accepted as a valid email address.
Thanks for checking @pdurbin. I used The discussion about this in a sprint planning meeting a while back made me think that we thought it was okay that people entered multiple email addresses in that email field, which would mean we should expect commas in that field. So when Danny wrote in #8193 that commas would be escaped, I thought that meant that the commas would appear in the email columns in the guestbook CSV files. Can we agree that we're okay with people entering multiple emails in that email field and that it should expect commas? Otherwise, I agree that it would be better for the field to accept only one valid email or that the text box should accept multiple entries without them needing to be comma-separated. |
@jggautier ok, thanks. I kicked it back to @sekmiller then. It sounds like we want to escape rather than strip. For a future issue or pull request, if we except multiple addresses separated by commas, the UI should probably indicate this. |
I re-did the coding so that all responses are double quotes which allows for commas to be displayed without breaking the csv output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this appears to work with most software packages; all the CSV parsers I tried do understand that commas inside double-quoted strings are not field separators. I even tried our own CSV ingest; not becuase anyone would want/need to ingest guestbooks as tabular data, but because we use a standard Apache CSV parser library that's used in many other opensource packages.
(I thought when we talked about this issue during a meeting that we wanted encode these commas; as a hex notation maybe - '%2C'? - but this is even better probably... So, approving)
(P.S. Please note that there appears to be a merge conflict) |
# Conflicts: # src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java
@landreev that merge conflict was caused by the introduction of a method for escaping csv strings for the text area guestbook response PR. I applied the method to other response strings because it makes the code cleaner. i'll put it back in review if you want to take a look. |
Sorry about my confusion during the standup. I missed the comment above. |
Oh yeah, we're still having an outbreak of the github automation plague (the approval didn't move the PR into QA automatically). Moving by hand... |
What this PR does / why we need it: fixes broken csv output from guestbook responses download
Which issue(s) this PR closes:
Closes #8193 Commas in email addresses breaks guestbook csv download
Special notes for your reviewer: Instead of removing commas from the email response, which had been the approach for all other responses, now all responses are enclosed in double quotes allowing the commas to remain without breaking the csv display
Suggestions on how to test this:
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: