Skip to content

File upload transliteration can break filename using FURL rules #16787

@juro

Description

@juro

Bug report

Summary

Enabling upload_translit and setting friendly_alias_max_length can break filenames upon upload

Step to reproduce

In system settings, enable upload_translit and set friendly_alias_max_length. Upload for example jpg file with filename length exceeding friendly_alias_max_length chars.

Observed behavior

Uploaded filename including extension is after transliteration trimmed to friendly_alias_max_length chars, thus losing its extension. While in some configurations file type is derived from file content itself and not from file extension, a lot of functionality is broken. For example, trying to delete such file leads to error saying that '' is not allowed file type. Also third party components are affected, like MoreGallery.
This results from modMediaSource calling xpdo->filterPathSegment() on uploaded filename.

Expected behavior

In the first place, FURL setting like friendly_alias_max_length should not be used for uploaded file names (there can be a separate setting). But the main point is that transliterating and trimming filenames should keep extensions intact, affecting only filename itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue in the code or project, which should be addressed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions