Plone 5 and mimetype.icons error

When I create a new File in Plone 5.0.7 and attach a file, it's mime icon is displayed but only in the Edit mode. In the View mode Plone cannot find the icon file. It does not matter what file type I attach.

E.g. for PDF file, in Edit mode I can see the icon, it's path is /pdf.png.

When I switch to View mode, it's path changes to ++resource++mimetype.icons/pdf.png which returns 404 Not Found error.

This could be your settings for the theme, do you use the default barceloneta ?

What is the full url of the images (full path would be great)?

I am using the default theme. I did not touch it. The URL to not displayed icon is https://new.creationism.org.pl/problemy-genezy/problemy-genezy-2006-t-xiv-nr-1-2/problemy-genezy-nr-1-2-okladka.pdf/++resource++mimetype.icons/pdf.png (this URL is displayed twice as 404 in Chrome Developer Tools)

Yes, this seems broken in 5.0.7. It doesn't happen in 5.0.6.

Just filed this:

According to a comment added in the issue, change this line in versions.cfg

Products.MimetypesRegistry = 2.0.10

to

Products.MimetypesRegistry = 2.1

and re-run buildout. I just tested this with Plone 5.0.7 and it worked.

1 Like

Thank you! Great tip. If the user don't have a versions.cfg local, put the version 2.1 inside a buildout.cfg file, in versions section and re-run buildout.

[versions]
buildout.sanitycheck = 1.0.2
collective.recipe.backup = 2.20
plone.recipe.command = 1.1
plone.recipe.precompiler = 0.6
Products.PloneHotfix20160830 = 1.3
Products.PloneHotfix20160419 = 1.0
# Fix (https://community.plone.org/t/plone-5-and-mimetype-icons-error/3943/7)
Products.MimetypesRegistry = 2.1
1 Like

I just upgraded a site from Plone 4.3.x to Plone 5.1.6 and I stumbled over this issue.

This is how I fixed it, since it seems at least for me it was broken after the upgrade. The code base I'm using is super huge so I can tell if it is an issue in plone itself, or just me.

    from Products.MimetypesRegistry.MimeTypeItem import PREFIX


    mimes_tool = api.portal.get_tool('mimetypes_registry')
    for mimetype in mimes_tool.mimetypes():
        first_mime = mimetype.mimetypes[0]
        attrs = {
            'name': first_mime,
            'new_name': first_mime,
            'mimetypes': mimetype.mimetypes,
            'extensions': mimetype.extensions,
            'icon_path': PREFIX + mimetype.icon_path,
            'binary': mimetype.binary,
            'globs': mimetype.globs,
        }

        mimes_tool.manage_editMimeType(**attrs)
1 Like