MediaService.GetMediaByPath always returns null on HttpApplication events
Hi, I'm currently in need to get a media item by its url. The funcion provided in the MediaService always returns null no matter what, while if I get an item by its ID it's perfectly fine.
My code is running on an HttpApplication event, more precisely the PreSendRequestHeaders
Sample code:
IMedia media = ApplicationContext.Current.Services.MediaService.GetMediaByPath(app.Request.Url.AbsolutePath);
The code in the core queries the Umbraco database umbracoFile property for an item matching the path of the media - but it looks like to me the functionality relies on only the path of the image being stored in the UmbracoFile property, and I think this has changed recently if you are using the cropper to be a JSON object including the path, but also crop information etc...
MediaService.GetMediaByPath always returns null on HttpApplication events
Hi, I'm currently in need to get a media item by its url. The funcion provided in the MediaService always returns null no matter what, while if I get an item by its ID it's perfectly fine.
My code is running on an HttpApplication event, more precisely the PreSendRequestHeaders
Sample code:
Hi Diogo
This is a bug with Umbraco:
issues.umbraco.org/issue/U4-6551
The code in the core queries the Umbraco database umbracoFile property for an item matching the path of the media - but it looks like to me the functionality relies on only the path of the image being stored in the UmbracoFile property, and I think this has changed recently if you are using the cropper to be a JSON object including the path, but also crop information etc...
Hello Marc, after I published this topic I actually went searching for what was happening and I came to this particular conclusion.
Is there any ETA for when this is getting fixed? Or a workaround I can use fairly soon?
is working on a reply...