Sitecore 10.2 running in Docker Desktop for Windows
While crawling content I started seeing tons of errors messages in the Sitecore log:
2080 13:47:43 ERROR DefaultMediaItemTextExtractor: Cannot extract content from media item with id '{59AB8B22-2179-48D5-AEF4-068DF0DED0E8}'.
Exception: PdfSharp.Pdf.IO.PdfReaderException
Message: The PDF document is protected with an encryption not supported by PDFsharp.
Source: PdfSharp
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.ValidatePassword(String inputPassword)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider provider)
at Sitecore.ContentSearch.ContentExtraction.Readers.PdfSharpReader.ReadAll(String filePath)
at Sitecore.ContentSearch.ContentExtraction.Common.DefaultMediaItemTextExtractor.ExtractTextFromMedia(MediaItem mediaItem)
What makes this even more strange is that {59AB8B22-2179-48D5-AEF4-068DF0DED0E8}
represents an item of template type /sitecore/templates/Foundation/Experience Accelerator/Upgrade/Upgrade Script
.
Is there a recommended solution to address this error?
Docker Image Solution?
One thing I did try, thinking that these were PDFS, was install the Adobe IFilter in the container.
Added the following to my CM Dockerfile:
COPY .\PDFFilter64installer.msi C:\install\
RUN Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i', 'C:\\install\\PDFFilter64installer.msi', '/quiet', '/norestart' -NoNewWindow -Wait; `
Remove-Item -Path 'C:\\install' -Recurse -Force;
Installer downloaded from Adobe's FTP site.
Then I patched the mediaFileTextExtractor
:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentManagement or ContentDelivery">
<contentSearch>
<indexConfigurations>
<contentExtraction>
<mediaFileTextExtractor>
<patch:delete />
</mediaFileTextExtractor>
<mediaFileTextExtractor type="Sitecore.ContentSearch.ContentExtraction.IFilter.IFilterMediaFileTextExtractor, Sitecore.ContentSearch.ContentExtraction"/>
</contentExtraction>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
Related links
Update
While this may not be the right solution for everyone, I was able to disable this functionality by using the following patch:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentManagement or ContentDelivery">
<!-- Save time by not extracting content. -->
<contentSearch>
<indexConfigurations>
<defaultSolrIndexConfiguration search:require="solr">
<mediaIndexing>
<mimeTypes>
<includes>
<patch:delete />
</includes>
<includes>
<mimeType type="Sitecore.ContentSearch.ComputedFields.MediaItemHtmlTextExtractor, Sitecore.ContentSearch">text/html</mimeType>
<mimeType>text/plain</mimeType>
</includes>
</mimeTypes>
<extensions>
<includes>
<patch:delete />
</includes>
<includes/>
</extensions>
</mediaIndexing>
</defaultSolrIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
Turns out that some of these items were from custom templates for media items which do not have associated blob data. Sitecore has no way to ignore content extraction based on template ID, hence the errors.