Error when filename has a space, special character

Created on 7 June 2023, about 1 year ago
Updated 9 June 2023, about 1 year ago

Problem/Motivation

The pdf_metadata module does not properly handle file names containing special characters and spaces when applied to a file within a media type. This limitation causes errors and prevents the module from functioning correctly in situations where documents need to include such characters or spaces in their names.

Steps to reproduce

1. Create a media that has the "Enable PDF Metadata?" option enabled for the file.

2. Upload a file containing spaces or special characters in its name.

3. Save the media.

4. Observe the errors generated when trying to save the media type.

Proposed resolution

Encode the file URL using PHP's rawurlencode() function to convert special characters, such as spaces, into their encoded representation (e.g., "%20" for spaces).

$encodedFileUri = rawurlencode($file['file']->getFileUri());

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fmitchell

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

Comments & Activities

Production build 0.69.0 2024