denny / ShinyCMS

ShinyCMS is an open source CMS. This is the Perl version, built with Catalyst and DBIC. (There is also a Ruby on Rails version: www.github.com/denny/ShinyCMS-ruby)
56 stars 24 forks source link

Page Content Too Long For DBIC #26

Closed wbraswell closed 8 years ago

wbraswell commented 9 years ago

By copying-and-pasting HTML content from a previously-existing website into CKEditor's "source" edit mode, I was able to exceed the storage length limitation of DBIC:

FastCGI: server "/tmp/shacfleet.org.fcgi" stderr: [error] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Data too long for column 'content' at row 1 [for Statement "UPDATE cms_page_element SET content = ? WHERE ( id = ? )" with ParamValues: 0='

, referer: http://shacfleet.org/admin/pages/page/10/edit

There should at least be some kind of meaningful error message produced.

denny commented 9 years ago

As discussed on IRC, that's a MySQL 'text' column, which can contain up to 65k characters. As a workaround for your own site, you could run the following command: alter table cms_page_element change column content content longtext;

Be warned that this is untested - if you have a lot of pages, or a lot of elements per page, then this might make your database quite large.

I'll look at catching overly-large posts and either throwing an error, or more likely truncating them and warning the user.

wbraswell commented 9 years ago

For now I will just figure out ways not to exceed the size limit, as I don't much like the idea of untested database changes.

wbraswell commented 8 years ago

Yay, at least we don't have a database bug any more! :+1: