core icon indicating copy to clipboard operation
core copied to clipboard

Need to save file twice to trigger exception

Open shaydotcms opened this issue 10 years ago • 4 comments

Related to #9197 In order to prevent the generation of empty metaData/content file, the system should trigger an exception if CONTENTALLOWZEROLENGTHFILES=false. Currently, the first time the file is saved, there’s not exception in the logs. You need to save the file twice to trigger the exception.

Steps to reproduce:

  1. Login to dotcms
  2. Upload a .txt file which size is than 0
  3. Open the .txt file and edit the content. Delete all data so the size now is 0

Before: image After: image

  1. Hit Save or Save/Publish
  2. You will see the file was successfully saved containing 0 bytes
  3. You need to hit Save or Save/Publish twice to trigger the exception:

image

Tested locally in: master-3.6 // Win7 Pro SP1 // SQLServer 2012 // Firefox master-3.6 // Mac OS 10.10 // MySQL 5.6.23 // Chrome

shaydotcms avatar Jun 29 '16 19:06 shaydotcms

For this to also throw the exception we need to include the validations in #9197 in the moveFile method as well

dsilvam avatar Jul 05 '16 20:07 dsilvam

PR: https://github.com/dotCMS/core/pull/9331. Tested with the property set to true, so files with 0 bytes upload without throwing the exception.

erickgonzalez avatar Jul 06 '16 20:07 erickgonzalez

I believe this is already documented here: http://auth.dotcms.com/docs/latest/file-configuration - but let me know if there is something I am missing

DeanGonzalez avatar Jul 06 '16 23:07 DeanGonzalez

Passed QA. Exception is being triggered the first time Tested locally in: master-3.6 // Mac OS 10.10 // MySQL 5.6.23 // Firefox v45.0.1

shaydotcms avatar Jul 07 '16 15:07 shaydotcms