rapila/cms-base — Issue #88: File upload document_type detection error
Author: juergmessmer
Created: 2011-10-27 11:54:27+00:00
State: open

if a Word document without extension is uploaded, a exception is thrown in

DocumentTypePreviewFileModule, line 57 (see below)

For some reason the file is mistaken as a image

[Thu Oct 27 13:46:34 2011] [error] [client 127.0.0.1] ([code] => 2, [message] => 'Division by zero', [filename] => '/Users/jmg/Sites/cms_altenburg/base/modules/file/document_type_preview/DocumentTypePreviewFileModule.php', [line] => 58, [trace] => ([0] => ([file] => '/Users/jmg/Sites/cms_altenburg/base/lib/classes/FileManager.php', [line] => 19, [function] => 'renderFile', [class] => 'DocumentTypePreviewFileModule', [object] => DocumentTypePreviewFileModule Object: ([oDocumentType] => DocumentType Object: ([id] => [...], [extension] => [...], [mimetype] => [...], [is_office_doc] => [...], [created_at] => [...], [updated_at] => [...], [created_by] => [...], [updated_by] => [...], [aUserRelatedByCreatedBy] => [...], [aUserRelatedByUpdatedBy] => [...], [collDocuments] => [...], [alreadyInSave] => [...], [alreadyInValidation] => [...], [validationFailures] => [...], [_new] => [...], [_deleted] => [...], [modifiedColumns] => [...], [virtualColumns] => [...]), [iSize] => 190, [aPath] => ([0] => [...])), [type] => '->', [args] => ()), [1] => ([file] => '/Users/jmg/Sites/cms_altenburg/base/lib/classes/Manager.php', [line] => 91, [function] => '__construct', [class] => 'FileManager', [object] => FileManager Object: ([oModule] => DocumentTypePreviewFileModule Object: ([oDocumentType] => [...], [iSize] => [...], [aPath] => [...])), [type] => '->', [args] => ()), [2] => ([file] => '/Users/jmg/Sites/cms_altenburg/base/lib/main.php', [line] => 12, [function] => 'getManager', [class] => 'Manager', [type] => '::', [args] => ()), [3] => ([file] => '/Users/jmg/Sites/cms_altenburg/index.php', [line] => 5, [args] => ([0] => '/Users/jmg/Sites/cms_altenburg/base/lib/main.php'), [function] => 'require_once')), [context] => ([sCacheString] => 'preview_18_190', [oCache] => Cache Object: ([bCacheIsNeverOff] => false, [sFilePath] => '/Users/jmg/Sites/cms_altenburg/generated/caches/images/e5b96d9baa7395456fe6cacb304e4071.cache', [bCacheControlHeaderSent] => false), [iTimestamp] => '2011-10-27 13:35:30', [sFileName] => 'default.png', [sFilePath] => '/Users/jmg/Sites/cms_altenburg/base/modules/file/document_type_preview/icons/default.png', [sFontFilePath] => '/Users/jmg/Sites/cms_altenburg/base/modules/file/document_type_preview/PTS55F.ttf', [oImage] => Image Object: ([rImageHandle] => resource of type (gd), [iWidth] => NULL , [iHeight] => NULL , [sFileType] => 'jpeg', [fScalingFactor] => 1, [iOriginalWidth] => 512, [iOriginalHeight] => 512), [sText] => '', [fFontSize] => 72, [aSize] => ([0] => 0, [1] => 0), [iDesiredWidth] => 300, [iDesiredHeight] => 145), [referrer] => 'http://cms_altenburg/admin/documents', [host] => 'cms_altenburg', [path] => '/get_file/document_type_preview/18?size=190'), referer: http://cms_altenburg/admin/documents