silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 65 forks source link

Limited Filename (path) length #593

Open AljosaB opened 4 months ago

AljosaB commented 4 months ago

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

Additional Context

maxime-rainville commented 4 months ago

Try adding this snippet to your YML config and running a dev/build. That solved if for me.

SilverStripe\Assets\Storage\DBFile:
  composite_db:
    Filename: "Varchar(512)"
AljosaB commented 4 months ago

That worked! Thanks @maxime-rainville