Skip to content

Limited Filename (path) length #593

@AljosaB

Description

@AljosaB

Module version(s) affected

2.1.2

Description

Usually there is a limit of 255 chars for a file name (at least on Windows) and there is the same limit in table "File" because fields "Name" and "Title" are Varchar(255). That is fine (for a file name length).

The customer pointed me to a folder where they wanted to upload a file with the name length of 73 chars and it didn't work. When I first tried to reproduce it, I uploaded it in the root and everything was fine, but when I tried uploading it few levels deeper in the folder hierarchy, I got a broken image with "file doesn't exist".

After trying for some time I found out that it works when the whole path (including all folder names separated with /) is <= 255 characters and it breaks when you get over 255. That is not a nice limit for a bigger sites that have files organised in deep folder structures.

How to reproduce

  • create a folder named "nunc vitae vestibulum felis vel facilisis arcu praesent ultricies eros ipsum ac vehicula neque lacin" (length: 100)
  • create a sub-folder with same name inside it (path length: 200 chars)
  • try to upload a file with 60 chars (for example: "this is a very nice image with 60 chars in the filename.png") (path length = 260 chars / > 255) -> broken file / file doesn't exist
  • try to upload a file with 40 chars (for example: "image with 40 chars in the filename.png") (path length = 240 chars / < 255) -> it works

Additional Context

  • there is a field "FileFilename" with Varchar(255) in the "File" table
  • it seems this field is storing the full file path (/folder1/folder2/filename.ext)
  • by searching over all files I was unable to find where it is declared
  • I was unable to extend it's length by using DataExtension
  • the problem went away after I manually extended the length in DB (tables: File, File_Live, File_Versions)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions