MyBB Community Forums

Full Version: Attachment file extension length limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So we converted over from a VB forum. I thought initially that the attachment ids had all gotten broken because lots of attachments would fail when you tried to download one. It turned out that it was because the custom attachment types didn't get carried forward. So I started adding them back and discovered that there's apparently a limit on the file extension length. One of our types, CQCMacroPack, is apparently one or two characters over the limit and so we can't add back that custom attachment type, which means that all of those attachments are stranded.

SQL Error:1406 - Data too long for column 'extension' at row 1Query:INSERT INTO mybb_attachtypes (name,mimetype,extension,maxsize,icon,enabled,groups,forums,avatarfile) VALUES ('CQCMacroPack','application/octet-stream','CQCMacroPack',180,'images/attachtypes/css.png',1,'-1','-1',0)

Is this limit intentional or just an oversight? Could we possibly get it bumped up a bit? So apparently the extension column is set to VARCHAR(10) in the database. I'm guessing it wouldn't really break any of the code if that was just increased, right?
Will be fine to bump it up manually in your table, I think it's just been set to 10 as almost all file extensions are 3-4 characters.
Since I'm not a SQL maven, what would be the appropriate command for that? I'm sure I could figure out what I think is the correct thing to do, but I just really don't want to do something stupid at this point after all of the effort involved in getting converted over.

I'm guessing something like this (table/column names may not be right, I'm not looking at the database right now.)

ALTER TABLE mybb_extentiontypes MODIFY extension VARCHAR(16);
Run this:

ALTER TABLE `mybb_attachtypes` CHANGE `extension` `extension` VARCHAR(16);
OK, though without the single quotes if doing it via the workbench query screen.

That worked, thanks.