Argument #1 ($mimeType) must be of type string, null given, called in /file.module in file\IconMimeTypes::getIconClass()

Created on 28 February 2025, about 1 month ago

Problem/Motivation

When I try to use a URI mapped to a file like "public://NewTextDocument.txt", the field mapper grabs the URI, and I think tries to use the xntt-file-field to load the file. This file was uploaded with an external entity form. But after going through the module. It looks like there is supposed to be some notation on the fid of files uploaded by external entities, but when going through the file_managed database, the uploaded files data looks like a normal file (they have integer fids, but they're supposed to be strings with data). Maybe for some reason the FIDs are no longer being handled correctly and in effect broke the xntt files.

Steps to reproduce

  1. Upload a file with external entities form.
  2. Try loading entity with file from a URI, using a REST request. Request will white screen with error, "TypeError: Drupal\file\IconMimeTypes::getIconClass(): Argument #1 ($mimeType) must be of type string, null given, called in /var/www/html/core/modules/file/file.module on line 1300 in Drupal\file\IconMimeTypes::getIconClass() (line 21 of core/modules/file/src/IconMimeTypes.php)."

Proposed resolution

Figure out if something may have changed in how files are handled or maybe I just dont understand how the module works.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024