Problem/Motivation

When using media library and uploading a file (tested with jpeg and docx) with an illegal character in the filename, in this test a "/" (forward slash), an upload error is produced

The specified file FILENAME.jpeg could not be uploaded.
This value should be of the correct primitive type.

.

The file name listed in the error message shows a ":" (Colon) not a "/" (forward slash). My assumption is upload handler code or media code is improperly sanitizing the filename.

Steps to reproduce

Vanilla install, create a media file field, create a jpeg or docx file with a "/" (forward slash) in the title, try and upload that file. view the renamed filename in the error message as having a colon.

Proposed resolution

change the sanatizing code to turn a "/" (forward slash) into a "-" (Dash) instead of a ":" (Colon).

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

destinationsound created an issue. See original summary.

destinationsound’s picture

Title: conversion of illegal character in file name causes error » improper sanitization of file name causes upload error
Issue summary: View changes

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.