OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Profile path too long when processing images #8603

Closed AndreaPiovanelli closed 2 years ago

AndreaPiovanelli commented 2 years ago

Reference issue #8602

When generating a image profile, sometimes resulting path can be very long, especially when a user imports a media with a very long file name. As described into the referenced issue, this can throw exceptions and stop Orchard from processing, for instance, resized images displayed as thumbnails in the media gallery. Since profile folders are already hashed, when file name is too long I hashed it the same way, eventually trimming it even more in extreme cases (this may happen when path is really long even before appending the file name).

AndreaPiovanelli commented 2 years ago

As we noticed issues when checking paths via out of context calls (e.g. calling the methods via rest apis), we realized ImageProfileManager was the wrong class to test for path format. For this reason, that logic has been moved inside the file storage provider.

We used the same pr as it hasn't been merged yet. Can you check this, @sebastienros?