Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getFileKindLabel() / TypeError: must be of the type string, null returned. #2354

Closed
ddbr opened this issue Jan 25, 2018 · 0 comments
Closed

Comments

@ddbr
Copy link

ddbr commented Jan 25, 2018

Description

When adding dxf and dwg using extraAllowedFileExtensions following error occurs when uploading a dxf file within admin Console -> Assets:

'extraAllowedFileExtensions' => 'dxf, dwg'

Error log:

> 2018-01-25 09:41:24 [213.196.159.4][1][-][error][TypeError] TypeError: Return value of craft\helpers\Assets::getFileKindLabel() must be of the type string, null returned in /var/www/html/vendor/craftcms/cms/src/helpers/Assets.php:288
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/elements/Asset.php(893): craft\helpers\Assets::getFileKindLabel('unknown')
#1 /var/www/html/vendor/craftcms/cms/src/base/Element.php(1640): craft\elements\Asset->tableAttributeHtml('kind')
#2 /var/www/html/vendor/twig/twig/lib/Twig/Extension/Core.php(1595): craft\base\Element->getTableAttributeHtml('kind')
#3 /var/www/html/vendor/craftcms/cms/src/helpers/Template.php(76): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(craft\elements\Asset), 'getTableAttribu...', Array, 'method', false, false)
#4 /var/www/html/storage/runtime/compiled_templates/6d/6d626ae811629fd3271e0c97435556f2ef0d5048763e97af2ea83627b442c0c6.php(138): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig_Source), Object(craft\elements\Asset), 'getTableAttribu...', Array, 'method')
#5 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(389): __TwigTemplate_7e74f9bdbb76ea693d036ffae11164eda40d130043fdd24dc3590b53ec839633->doDisplay(Array, Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(51): Twig_Template->displayWithErrorHandling(Array, Array)
#7 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(366): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#8 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(32): Twig_Template->display(Array, Array)
#9 /var/www/html/storage/runtime/compiled_templates/ac/ac18635758b5c277dd17ae309ba5c86b9790f843cfcb4567db08956b97d17a11.php(77): craft\web\twig\Template->display(Array)
#10 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(389): __TwigTemplate_0373910080618291bb3a21c0cd52e7420ece5fa4e0566e5cd3e4dfa02fbe9978->doDisplay(Array, Array)
#11 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(51): Twig_Template->displayWithErrorHandling(Array, Array)
#12 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(366): craft\web\twig\Template->displayWithErrorHandling(Array, Array)
#13 /var/www/html/vendor/craftcms/cms/src/web/twig/Template.php(32): Twig_Template->display(Array, Array)
#14 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(374): craft\web\twig\Template->display(Array)
#15 /var/www/html/vendor/twig/twig/lib/Twig/Environment.php(289): Twig_Template->render(Array)
#16 /var/www/html/vendor/craftcms/cms/src/web/View.php(292): Twig_Environment->render('_elements/table...', Array)
#17 /var/www/html/vendor/craftcms/cms/src/base/Element.php(441): craft\web\View->renderTemplate('_elements/table...', Array)
#18 /var/www/html/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(391): craft\base\Element::indexHtml(Object(craft\elements\db\AssetQuery), Array, Array, 'folder:4/folder...', 'index', true, true)
#19 /var/www/html/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(119): craft\controllers\ElementIndexesController->_elementResponseData(true, true)
#20 [internal function]: craft\controllers\ElementIndexesController->actionGetElements()
#21 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#22 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#23 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(80): yii\base\Controller->runAction('get-elements', Array)
#24 /var/www/html/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('get-elements', Array)
#25 /var/www/html/vendor/craftcms/cms/src/web/Application.php(243): yii\base\Module->runAction('element-indexes...', Array)
#26 /var/www/html/vendor/craftcms/cms/src/web/Application.php(421): craft\web\Application->runAction('element-indexes...', Array)
#27 /var/www/html/vendor/craftcms/cms/src/web/Application.php(203): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#28 /var/www/html/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#29 /var/www/html/web/index.php(23): yii\base\Application->run()
#30 {main}

Steps to reproduce

  1. Add 'extraAllowedFileExtensions' => 'dxf, dwg' in /config/General.php
  2. Upload dxf File within Assets in Admin Console
  3. Show folder where File had beeing upladed.

Temp Fix

When adjusting Function getFileKindLabel() to return '' instead of null, the error does not occur.

return null;

Additional info

  • Craft version: Craft Pro 3.0.0-RC5
  • PHP version: 7.0.22-0ubuntu0.17.04.1
  • Database driver & version: MySQL 5.7.20-0ubuntu0.17.04.1
  • Plugins & versions: Redactor 1.0.0.1 / XML Sitemap v1.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant