Hello

When I run cron on my website with the latest Search API attachment module I get an error, which tells me there is a problem with the getExcludedMimes function in Plugin/search_api/processor/FilesExtrator.phh. In this foreach

      if (!$extensions) {
        $extensions = $this->defaultExcludedExtensions();
      }
      $excluded_mimes = [];
      foreach ($extensions as $extension) {

        $excluded_mimes[] = $this->mimeTypeGuesser->guess('dummy.' . $extension);
      }

After the debugging I found that the function defaultExcludedExtensions builds an array but at the end this happens:

return implode(' ', $excluded);

So it returns a string.
The foreach needs an array, but a string is given.

I've have included a patch.
I hope this can help someone.

CommentFileSizeAuthor
Search-api-attachment-FilesExtrator.patch738 bytessimon_h

Comments

simon_h created an issue. See original summary.

ekes’s picture

Status: Active » Closed (duplicate)

Pretty sure #2821884: Default excluded extensions not working correctly will fix it for you.

I guess I've used it, and it worked, and yet forgotten to review the patch. Maybe you'd like to test it and set it to 'reviewed by the community' if it's good.

simon_h’s picture

Yes, indeed.
Sorry for the double post, I was to quick with posting this one.