EAD import fails when multiple container elements have the same barcode in their label attributes, but with an extra space

Description

For example, if these two elements...

...exist in one EAD file (in two different file-level components) then the import job fails with the following message:

Editing out the space before the close-square-bracket allows it to import successfully.

The reason is that when the EAD importer processes the first of the above containers, it creates a row in the top_container database table. Then, when it encounters the second one, it tries to create another row. But it cannot due to a uniqueness constraint (on the combination of repo_id and barcode columns) which is triggered because when matching VARCHAR datatype strings MySQL ignores trailing spaces. This should be prevented by an in-memory cache of top containers already created in the same job, but that uses a Ruby hash, in which trailing spaces are significant.

Environment

None

Activity

Show:
Andrew Morrison
June 9, 2020, 5:24 PM

Fix submitted at

Assignee

Andrew Morrison

Reporter

Andrew Morrison

Labels

Priority

Minor
Configure