Database storage only works with ASCII public_id

Created on 10 October 2024, 9 months ago

Problem/Motivation

When uploading files that have non-ASCII characters in their filename the cloudinary database storage module cannot save them. The public_id column of the cloudinary_storage table is defined as a varchar_ascii type, which results in the following error when using non-ASCII characters:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '=': SELECT "cs".* FROM "cloudinary_storage" "cs" WHERE "public_id" = :db_condition_placeholder_0 LIMIT 1 OFFSET 0; Array ( [:db_condition_placeholder_0] => ) in Drupal\cloudinary_storage_db\CloudinaryStorageDb->load() (regel 69 van /code/web/modules/contrib/cloudinary/modules/cloudinary_storage/modules/cloudinary_storage_db/src/CloudinaryStorageDb.php).

Steps to reproduce

  1. Enable the cloudinary_storage_db module
  2. Upload a to Cloudinary using non-ASCII characters (e.g. é) in the filename
  3. Select the file in a cloudinary media entity

Proposed resolution

Change the column type of cloudinary_storage.public_id to varchar.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇧🇪Belgium klaasvw

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