IntegrationKit import of media fails with exception

I am running an importer using IntegrationKit and I am receiving an error importing an jpg image. It is not a particularly exceptional image being relatively small at only 722kb although it does have a somewhat long name (100+ characters). The error is as follows:

String or binary data would be truncated.
The statement has been terminated.

Here is a part of the StackTrace if it helps:

at Litium.Application.Data.LitiumDbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
at Litium.Application.Data.Batching.BatchDataImpl.Commit()
at Litium.Application.Media.FileServiceImpl.Create(File file)

So far other images of the same type have imported successfully. Any tips appreciated!

Litium version: 7.0.0

Is it possible to change the image-name to a shorter and try?

The name of the file appears to not matter, but the Id was the issue. I see in the database that this field is type nvarchar(100) so the length of the File Id is clearly the issue.

I’ve just been setting the Id to the filename without the extension. Are there any “best practices” regarding setting the Id that others use regarding media file Id’s?

You can set product/variant id and with “_A” or “_B”… suffix if more then one image.

The File.Id is not the same as File.FileName and the Id column that is restricted to 100 characters should be used for an integration id for the file, example the File ID from the external DAM system.

The File.Id need to be unique over all images, even if they are in different folders. When you upload files in back office the File.Id is not set (it is not mandatory) so you can upload a file with the same name in two different folders.

If you do not need to be able to fetch the file by the Id then I think you should remove the row `Id = item.FileInfo.Name´ from the MediaImporter.cs in integration kit. The default code will be updated with the same change because the File.Id is not used to see if the file exists or it should be replaced either.