Double old-path record will cause the import to throw a 500
jjanssen opened this issue · 0 comments
jjanssen commented
In an occasion where an Excel list is handed over there is a possibility where a duplicate from-record exists. For example, having a file with over 1.000 records could have the following:
From | To |
---|---|
/my/previous/location/1 | /my/new/path |
/my/previous/location/1 | /my/new/some-other-path |
When this is present the importer will throw an error as it tries to save another record in which old_path
is classified unique:
duplicate key value violates unique constraint "wagtailredirects_redirect_old_path_site_id_783622d7_uniq"
DETAIL: Key (old_path, site_id)=(/my/previous/location/1, 3) already exists.
mechanism
Proposed solution
We should wrap this in a try-catch, process the file accordingly and notify we have skipped a record due to a duplication.