V8: Lowercase media-path hardcoded in regex
See original GitHub issueWe had a strange issue with a Umbraco 8.4-site where images uploaded would not be selectable in a Media Picker when “select only images” was activated.
When I looked closer at it, the “Media Grid” is setting up the selectable-state based on the property mediaEntity.metaData.MediaPath which was always null in our case. It also turns out that all rows in the umbracoMediaVersion-table had the value “null” for the path-column.
After some digging around it turned out the we’ve had this setting in web.config
<add key="umbracoMediaPath" value="~/Media" />
Note the uppercase M in Media, then when the MediaFactory is trying to use regex to find a media-url inside a property value this fails since the regex MediaPathPattern is hardcoded to /media (lowercase).
The same would also be true if one where to rename the media-folder to something like “assets”, then this regex would not work, umbracoMediaVersion.parth would be null and the images would not be selectable in the “Image-Media-Picker” or in the RTE/Grid so it’s not just a matter of making it case-insensible, it needs to respect the settings in web.config.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Yep, should do. Farewell Regex! 👍
This will be released in 8.6.0 @enkelmedia - https://github.com/umbraco/Umbraco-CMS/issues/6324
Haha =D I can’t blame an upgrade from 4.5.2 =D But I guess that you’re right, it probably something that has just been around since before Justin Bieber was famous 😉
Sounds like a plan! I’ll have a look at the regex tomorrow, seems like it should be quite straight forward, some small questions:
Another thing that is somewhat related is that the full path to media-files are stored in different places (ie umbracoMediaVersion.path), if someone was to change the media-folder after files have been created you would end up in a “bad place” - at the same time - it’s probably not a huge use case, but anyway - let me know if we should create an issue reg. this to keep it in the backlog.
Cheers!