Issue with filename length

Created on 20 July 2025, about 1 month ago

When importing certain items with long query string I believe file_managed takes the filename from the url. I suspect in these cases the length of file_managed filename column also needs adjusting. Here is what a typical failed migration looks like. This can stop the migration working

e.g.

  1/110 [>---------------------------]   0%
  2/110 [>---------------------------]   1%
  3/110 [>---------------------------]   2%
  4/110 [=>--------------------------]   3%
In SqlContentEntityStorage.php line 817:

 SQLSTATE[22001]: String data, right truncated: 1406 Data too long for colum  
 n 'filename' at row 1: INSERT INTO "file_managed" ("uuid", "langcode", "uid  
 ", "filename", "uri", "filemime", "filesize", "status", "created", "changed  
 ") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_p  
 laceholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_inser  
 t_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_in  
 sert_placeholder_8, :db_insert_placeholder_9); Array                         
 (                                                                            
     [:db_insert_placeholder_0] => 81f47099-0722-4794-ad41-e4f221abe796       
     [:db_insert_placeholder_1] => en                                         
     [:db_insert_placeholder_2] => 0                                          
     [:db_insert_placeholder_3] => 2887.jpg?width=1200&height=630&quality=85  
 &auto=format&fit=crop&precrop=40:21,offset-x50,offset-y0&overlay-align=bott  
 om%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGc  
 tZGVmYXVsdC5wbmc&enable=upscale&s=90e310bccab68370928a8ebbafc661a3           
     [:db_insert_placeholder_4] => https://i.guim.co.uk/img/media/301e6b066d  
 5858c8cd9595eed287e1a19b820e40/606_207_2887_2309/master/2887.jpg?width=1200  
 &height=630&quality=85&auto=format&fit=crop&precrop=40:21,offset-x50,offset  
 -y0&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zd  
 GF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=90e310bccab68370928  
 a8ebbafc661a3                                                                
     [:db_insert_placeholder_5] => image/jpeg                                 
     [:db_insert_placeholder_6] => 85471                                      
     [:db_insert_placeholder_7] => 1                                          
     [:db_insert_placeholder_8] => 1753014605                                 
     [:db_insert_placeholder_9] => 1753014605                                 
 )                                                                            


In ExceptionHandler.php line 56:

 SQLSTATE[22001]: String data, right truncated: 1406 Data too long for colum  
 n 'filename' at row 1: INSERT INTO "file_managed" ("uuid", "langcode", "uid  
 ", "filename", "uri", "filemime", "filesize", "status", "created", "changed  
 ") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_p  
 laceholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_inser  
 t_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_in  
 sert_placeholder_8, :db_insert_placeholder_9); Array                         
 (                                                                            
     [:db_insert_placeholder_0] => 81f47099-0722-4794-ad41-e4f221abe796       
     [:db_insert_placeholder_1] => en                                         
     [:db_insert_placeholder_2] => 0                                          
     [:db_insert_placeholder_3] => 2887.jpg?width=1200&height=630&quality=85  
 &auto=format&fit=crop&precrop=40:21,offset-x50,offset-y0&overlay-align=bott  
 om%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zdGF0aWMvb3ZlcmxheXMvdGc  
 tZGVmYXVsdC5wbmc&enable=upscale&s=90e310bccab68370928a8ebbafc661a3           
     [:db_insert_placeholder_4] => https://i.guim.co.uk/img/media/301e6b066d  
 5858c8cd9595eed287e1a19b820e40/606_207_2887_2309/master/2887.jpg?width=1200  
 &height=630&quality=85&auto=format&fit=crop&precrop=40:21,offset-x50,offset  
 -y0&overlay-align=bottom%2Cleft&overlay-width=100p&overlay-base64=L2ltZy9zd  
 GF0aWMvb3ZlcmxheXMvdGctZGVmYXVsdC5wbmc&enable=upscale&s=90e310bccab68370928  
 a8ebbafc661a3                                                                
     [:db_insert_placeholder_5] => image/jpeg                                 
     [:db_insert_placeholder_6] => 85471                                      
     [:db_insert_placeholder_7] => 1                                          
     [:db_insert_placeholder_8] => 1753014605                                 
     [:db_insert_placeholder_9] => 1753014605                                 
 )                                                                            


In StatementWrapperIterator.php line 113:

 SQLSTATE[22001]: String data, right truncated: 1406 Data too long for colum  
 n 'filename' at row 1                                                        

Here we can see db_insert_placeholder_3 refers to filename

In this case filename is the same as url without the `https://i.guim.co.uk/img/media/301e6b066d
5858c8cd9595eed287e1a19b820e40/606_207_2887_2309/master/`

In this case the character count is 271 which is over and above the standard 256. See screenshot.

I think it might make sense to give filename the same length as uri column

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom 2dareis2do

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024