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

Validation of extended CSV fields is not being done properly #2759

Open
stsccfr opened this issue Oct 27, 2024 · 0 comments
Open

Validation of extended CSV fields is not being done properly #2759

stsccfr opened this issue Oct 27, 2024 · 0 comments
Assignees
Labels

Comments

@stsccfr
Copy link
Collaborator

stsccfr commented Oct 27, 2024

I discovered two files in the Staffordshire database each of which contained an invalid extended CSV field, and yet the FreeREG server had accepted them. I then uploaded a baptism file, STSABCBA.CSV, which had BAPTISMS in the first header line, but whose FlexCSV fields were all for marriages (marriage_date, groom_name, etc). That file was also accepted by the server. Another consequence of the bad processing is that the date range reported for the file is wrong. The file contains a single entry dated 1608, but the date range reported by the server (in the email it sends out) is 2024-1300.

STSABCBA.CSV

I think the culprit is in the function for valid_field_definition() in lib/new_freereg_csv_update_processor.rb and is this line:

entry_fields = Freereg1CsvEntry.attribute_names

which defines the valid field names to be the entire collection of named attributes in the Freereg1CsvEntry class, which is all FlexCSV fields for all 3 event types (baptisms, marriages, burials), and anything else that happens to be defined in that class. This means that one can construct a CSV file using any random selection of the field names for the 3 events and the server will accept it. Proper validation of uploaded files is important especially given that they don't all come from a single source.

Instead of the class attribute names, I think we should be using the lists of event-specific FlexCSV field names defined in lib/freereg_options_constants.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants