Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298686

Drupal\file\IconMimeTypes doesn't handle NULL mimetypes

$
0
0

Problem/Motivation

Drupal\file\IconMimeTypes cannot handle NULL value for mimetype well. Errors out pages with file references to file with NULL as the mimetype.

Steps to reproduce

Attempt to view or edit a page with a file reference to a file with NULL as the mimetype, where a variable icon is expected to display.

Instead you'll get a white error page, with watchdog errors, e.g., TypeError: Drupal\file\IconMimeTypes::getIconClass(): Argument #1 ($mimeType) must be of type string, null given ...

Proposed resolution

The problem is that the database table file_managed allows NULL for the filemime column, but the internal methods of Drupal\file\IconMimeTypes require strings and can't handle NULL at all.

The signatures should be altered to allow NULL values, and to handle them gracefully, as did the file_icon_class() function this class replaces.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 298686


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>