esmero / ami

Archipelago Multi Importer. A module of mass ingest made for the masses
GNU Affero General Public License v3.0
2 stars 4 forks source link

CSV exporter might fail if the CID used by the temporary storage surpasses the max DB length for the name #177

Closed DiegoPino closed 1 year ago

DiegoPino commented 1 year ago

What?

Unheard of before. But I should have known better bc I saw something (and fixed) similar while building the LoD reconciliation service.

During an CSV export, to keep the order of children/parents in place we generate a Batch that uses temporary storage. Temporary storage requires a unique ID per item, and that one (to avoid overlaps while multiple users export at the same time or a single user does the same) is generated using a combination of the Views, the Display ID, etc

See:

https://github.com/esmero/ami/blob/9283bf06670296c29ed3bec43edbaf9769f23947/src/Plugin/Action/AmiStrawberryfieldCSVexport.php#L553-L555

This name, when the Views Machine name + the Display name are very long (happened to me, I promise) will fail badly at the DB level! (gosh drupal) giving you a truly scary exception 👻

Solution is to reduce the whole thing to an md5() and done.

DiegoPino commented 1 year ago

Solved via https://github.com/esmero/ami/commit/cdf77a6336c16ec1e6a53e368612a8ea851d0320 but I will have to go the long and pailful road of making an issue/pull at drupal for this one https://git.drupalcode.org/project/views_bulk_operations/-/blob/4.2.x/src/ViewsBulkOperationsBatch.php#L76