Fixed SMF attachments with crazy (long) filenames not imported

Overscan

Active member
Found another issue with attachments. I have one user (!) who uploaded a bunch of files named like this:

The first Airbus Industrie A-300 design of July 1967; with the 6.1 metre (20') diameter fuselage & 2 x 47,500 lb thrust Rolls-Royce RB-207 engines 1.......jpg

SMF stored them OK, though it sometimes couldn't show the filename. After migration, the attachment is gone. I note that if I try to upload these pics to Xenforo manually, many (not all) will not upload, so the problem is presumably they are violating allowable rules on filenames in Xenforo or something.

Obviously, I would like to import these files into Xenforo. Any ideas? Presumably I could rename the filename references in the database before migration via some kind of SQL query, or rewrite the SMP.php importer to sanitise the filenames. Any idea what the specific rules would be for a valid 'filename' value?
 
As far as I can tell, this is simply a case of the filename being too long.

In the SMF importer, I think the only change is to find:
PHP:
$this->_convertToUtf8($attachment['filename'], true),

And replace with:
PHP:
$this->_convertToUtf8(utf8_substr($attachment['filename'], 0, 100), true),
 
Thanks Chris - I will redo my test migration and see if that fixes it. All the ones that don't work are very long, so it seems plausible. SMF filename is stored as VARCHAR(255).
 
Top Bottom