solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 61 forks source link

Calling unknown method: craft\elements\Asset::thumbUrl() #1300

Closed bhashkar007 closed 5 months ago

bhashkar007 commented 5 months ago

What happened?

I created a fom with File Upload fields (with File Kinds PDF, TEXT and Word) so that user can upload their resume and submit the form. The form submission is working fine. I am getting error while going to view form submission from Craft CP. Please see stack trace of this error

Errors and Stack Trace (if available)

Twig\Error\RuntimeError: Calling unknown method: craft\elements\Asset::thumbUrl() in /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/templates/submissions/fields/file.twig:12
Stack trace:
#0 /var/www/html/storage/runtime/compiled_templates/31/31e9273c8ef0fabd3c2c20ade0e43bf4.php(69): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\elements\Asset), 'thumbUrl', Array, 'method', false, false, false, 12)
#1 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_5d24ce5e561ab1b518e49d3d609fbbe5->doDisplay(Array, Array)
#2 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#4 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#5 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render('freeform/submis...', Array)
#7 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/Services/SubmissionsService.php(338): craft\web\View->renderTemplate('freeform/submis...', Array)
#8 [internal function]: Solspace\Freeform\Services\SubmissionsService->renderSubmissionField(Object(Solspace\Freeform\Fields\Implementations\FileUploadField), Object(Solspace\Freeform\Elements\Submission))
#9 /var/www/html/vendor/solspace/craft-freeform/packages/plugin/src/Twig/Filters/FreeformTwigFilters.php(33): call_user_func(Array, Object(Solspace\Freeform\Fields\Implementations\FileUploadField), Object(Solspace\Freeform\Elements\Submission))
#10 /var/www/html/storage/runtime/compiled_templates/21/2165d1aaefa9bc2d025c531a75bbf9f7.php(74): Solspace\Freeform\Twig\Filters\FreeformTwigFilters->callUserFunction(Array, Object(Solspace\Freeform\Fields\Implementations\FileUploadField), Object(Solspace\Freeform\Elements\Submission))
#11 /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php(1224): __TwigTemplate_8e87d3e97c7df56ad8f0c2066acea2aa->macro_render(Object(Solspace\Freeform\Form\Layout\Row), Object(Solspace\Freeform\Elements\Submission), Array)
#12 /var/www/html/storage/runtime/compiled_templates/51/518be4901e0ca6422897fecc7ac0ae35.php(267): twig_call_macro(Object(__TwigTemplate_8e87d3e97c7df56ad8f0c2066acea2aa), 'macro_render', Array, 88, Array, Object(Twig\Source))
#13 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_6b5b4fa6e7486af21cbc2b0ad391c711->block_content(Array, Array)
#14 /var/www/html/storage/runtime/compiled_templates/7f/7fa221bd28d8f66f98c7792ae02bdbf9.php(667): Twig\Template->displayBlock('content', Array, Array)
#15 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_17d6355df3876d294c217065a934b94a->block_main(Array, Array)
#16 /var/www/html/storage/runtime/compiled_templates/7f/7fa221bd28d8f66f98c7792ae02bdbf9.php(399): Twig\Template->displayBlock('main', Array, Array)
#17 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_17d6355df3876d294c217065a934b94a->block_body(Array, Array)
#18 /var/www/html/vendor/twig/twig/src/Template.php(134): Twig\Template->displayBlock('body', Array, Array, false)
#19 /var/www/html/storage/runtime/compiled_templates/9d/9da13d4d7925164c2c4fc9271aaeebbd.php(54): Twig\Template->displayParentBlock('body', Array, Array)
#20 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_0546e24c36e22f1fd932d1c0c375f7ab->block_body(Array, Array)
#21 /var/www/html/vendor/twig/twig/src/Template.php(134): Twig\Template->displayBlock('body', Array, Array, false)
#22 /var/www/html/storage/runtime/compiled_templates/51/518be4901e0ca6422897fecc7ac0ae35.php(134): Twig\Template->displayParentBlock('body', Array, Array)
#23 /var/www/html/vendor/twig/twig/src/Template.php(171): __TwigTemplate_6b5b4fa6e7486af21cbc2b0ad391c711->block_body(Array, Array)
#24 /var/www/html/storage/runtime/compiled_templates/40/4075bbad018bccca7c981e73a72f9911.php(97): Twig\Template->displayBlock('body', Array, Array)
#25 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_b58345d3ae936473c73e83ab3dfc5405->doDisplay(Array, Array)
#26 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#27 /var/www/html/storage/runtime/compiled_templates/7f/7f9774821217e0e9fc78292da9570f14.php(56): Twig\Template->display(Array, Array)
#28 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_c6554a6d9bf49e601ca48781ea9bcef7->doDisplay(Array, Array)
#29 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#30 /var/www/html/storage/runtime/compiled_templates/7f/7fa221bd28d8f66f98c7792ae02bdbf9.php(170): Twig\Template->display(Array, Array)
#31 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_17d6355df3876d294c217065a934b94a->doDisplay(Array, Array)
#32 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#33 /var/www/html/storage/runtime/compiled_templates/9d/9da13d4d7925164c2c4fc9271aaeebbd.php(43): Twig\Template->display(Array, Array)
#34 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_0546e24c36e22f1fd932d1c0c375f7ab->doDisplay(Array, Array)
#35 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#36 /var/www/html/storage/runtime/compiled_templates/51/518be4901e0ca6422897fecc7ac0ae35.php(68): Twig\Template->display(Array, Array)
#37 /var/www/html/vendor/twig/twig/src/Template.php(394): __TwigTemplate_6b5b4fa6e7486af21cbc2b0ad391c711->doDisplay(Array, Array)
#38 /var/www/html/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#39 /var/www/html/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#40 /var/www/html/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render(Array)
#41 /var/www/html/vendor/twig/twig/src/Environment.php(280): Twig\TemplateWrapper->render(Array)
#42 /var/www/html/vendor/craftcms/cms/src/web/View.php(482): Twig\Environment->render('freeform/submis...', Array)
#43 /var/www/html/vendor/craftcms/cms/src/web/View.php(535): craft\web\View->renderTemplate('freeform/submis...', Array)
#44 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(57): craft\web\View->renderPageTemplate('freeform/submis...', Array, 'cp')
#45 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#46 /var/www/html/vendor/craftcms/cms/src/web/Response.php(338): yii\web\Response->prepare()
#47 /var/www/html/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#48 /var/www/html/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#49 /var/www/html/public/index.php(12): yii\base\Application->run()
#50 {main}

How can we reproduce this?

  1. Create a form with File Upload field type with the setting of File Kinds as PDF.
  2. Submit this form from front end by uploading PDF file
  3. Login to Craft dashboard => Freeform => Submissions => Click to view submitted form data

Freeform Edition

Lite

Freeform Version

5.2.2

Craft Version

5.1.6

When did this issue start?

Fresh install of Freeform

Previous Freeform Version

No response

gustavs-gutmanis commented 5 months ago

Thanks for reporting this @bhashkar007!

The fix is going to be released with the upcoming release.

kjmartens commented 5 months ago

This is now resolved in Freeform 5.3.0+ 🙂