Problem/Motivation
Warning: Undefined array key "image_mime_type" in /app/web/modules/contrib/unstructured/src/Formatters/MarkdownFormatter.php on line 188
Warning: Undefined array key "image_base64" in /app/web/modules/contrib/unstructured/src/Formatters/MarkdownFormatter.php on line 202
Deprecated: base64_decode(): Passing null to parameter #1 ($string) of type string is deprecated in /app/web/modules/contrib/unstructured/src/Formatters/MarkdownFormatter.php on line 202
The website encountered an unexpected error. Try again later.TypeError: Drupal\unstructured\Formatters\MarkdownFormatter::formatType(): Return value must be of type string, none returned in Drupal\unstructured\Formatters\MarkdownFormatter->formatType() (line 93 of modules/contrib/unstructured/src/Formatters/MarkdownFormatter.php). Drupal\unstructured\Formatters\MarkdownFormatter->format(Array, 'none') (Line: 246)
Drupal\unstructured\Plugin\AiAutomatorType\FileToTextBase->generate(Object, Object, Array) (Line: 70)
Drupal\ai_automator\AiAutomatorRuleRunner->generateResponse(Object, Object, Array) (Line: 70)
Drupal\ai_automator\Plugin\AiAutomatorProcess\DirectSaveProcessing->modify(Object, Object, Array) (Line: 229)
Drupal\ai_automator\AiAutomatorEntityModifier->markFieldForProcessing(Object, Object, Array, Object) (Line: 129)
Drupal\ai_automator\AiAutomatorEntityModifier->saveEntity(Object) (Line: 31)
ai_automator_entity_presave(Object)
call_user_func_array(Object, Array) (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'ai_automator') (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_presave', Object) (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll('entity_presave', Array) (Line: 217)
Drupal\Core\Entity\EntityStorageBase->invokeHook('presave', Object) (Line: 900)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('presave', Object) (Line: 529)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 753)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 107)
Drupal\custom\Batch\MinutesParserBatch->create(0, '121300', '232770', Array) (Line: 76)
Drupal\custom\Batch\MinutesParserBatch::process(0, Array, '232770', Array) (Line: 296)
_batch_process() (Line: 138)
_batch_do() (Line: 94)
_batch_page(Object) (Line: 52)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 38)
Drupal\mercury_editor\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
Upload files that return unknown results.
Proposed resolution
Add default renderLinks call.
Remaining tasks
N/A
User interface changes
N/A
API changes
It will fall back to links.
Data model changes
Issue fork unstructured-3471084
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
nicxvan commentedComment #4
marcus_johansson commentedSo there are two bugs happening here actually:
1. If you disabled the generate images, the markdown system should be aware of that and not generate images. I seem to have forgot that totally, I created a separate ticket for it here and will have a look during the weekend: https://www.drupal.org/project/unstructured/issues/3471136
2. The other thing your code solves, seems to be an image existing without metadata? I think your solution is as close as we get - it returns empty, because it can't generate the image.
If you want me to have a look at it, I would need to have a test document, if its not a secret, but I don't think I can improve on the solution tbh. So I would be happy to merge this as a solution, when the image is missing metadata. Let me know.
Comment #5
nicxvan commentedI think there is a third one, an unrecognized response being sent to formatType, there is no default after I "fixed" the image issue I got more errors which is why I added the default case, I'm just not sure how you want to handle an unknown, the error was that formatType wasn't returning a string.
Comment #10
nicxvan commentedComment #11
nicxvan commentedComment #12
nicxvan commentedComment #13
nicxvan commented