percussion / percussioncms

Percussion CMS - Content Management System
https://percussioncmshelp.intsof.com/percussioncms
Apache License 2.0
11 stars 9 forks source link

Files uploaded as File assets are inaccessible after 8.1.2 upgrade #761

Closed mariosm1 closed 1 year ago

mariosm1 commented 1 year ago

Describe the bug Files can not be viewed after installing the 8.1.2 version. The File asset itself can be viewed and edited, but the file that is stored in it can not.

To Reproduce Steps to reproduce the behavior:

  1. Upload any kind of file asset in version 8.0.3
  2. Upgrade to 8.1.2
  3. Try to preview or publish the same file asset and you will see an error page or Server Error dialog
natechadwick commented 1 year ago

This looks like an issue that affects instances with a database schema installed prior to CM1 version 5.3. The issue is a column name that was changed on the CT_PERCFILEASSET table (ITEM_FILE_ATTACHMENTX was changed to ITEM_FILE_ATTACHMENT) . Instead of renaming the column on upgrade, the install adds a duplicate column. This column is where the binary asset is stored so File assets will fail to preview or publish after upgrade.

Workaround

For MySQL/MariaDB backends (replace CM1 with the percussion database name:

USE CM1;

DESCRIBE  CT_PERCFILEASSET;

--verify ITEM_FILE_ATTACHMENTX is present - if not - no action is needed.

SELECT COUNT(*) FROM CT_PERCFILEASSET WHERE ITEM_FILE_ATTACHMENT <> NULL;

--should be 0

ALTER TABLE CT_PERCFILEASSET DROP COLUMN ITEM_FILE_ATTACHMENT;

ALTER TABLE CT_PERCFILEASSET CHANGE ITEM_FILE_ATTACHMENTX ITEM_FILE_ATTACHMENT longblob null;

After these changes are made, stop and start the CMS service and File Assets should be resolved. If a file Asset had been edited before the change and a 404 is still displayed, view the Revision History for the affected asset, and Promote the previous Revision.