We have moved to GitHub Issues
You are viewing the read-only archive of Umbraco's issue tracker. To create new issues, please head over to GitHub Issues.
Make sure to read the blog posts announcing the move for more information.
Created by Richard Terris 24 Apr 2015, 08:37:51 Updated by Warren Buckley 21 Jun 2016, 08:23:58
Is required for: COU-349
MediaService.GetMediaByPath("/media/1028/img2.jpg"); is returning null We have tried with various hard coded image paths for testing but getting null - the path above is the same format as the example given in the method documentation so we now assume this to be a bug.
What did you expect to happen? We expect an IMedia object to be returned. What actually happened? null was returned.
Still around in Umbraco 7.3.1
I think this is because the GetMediaByPath method is looking for an exact match of the path of the media file in the umbracoFile field in the database, however if you are using the cropper, the exact path won't be the only thing stored in the umbracoFile property, you will have instead a JSON object containing the src of the image, but additional crop information - so the lookup fails and returns null.
Func<string, Sql> createSql = url => new Sql().Select("*")
.From
fix would be to either additionally store the src media url in the VarChar field (the json object is now in the nVarChar field) or update the query above in the Media Service GetMediaByPath to look for a value 'beginning with' {src: '/media/1223/mediapathfile.jpg' etc
All good @claus merged in
Priority: Task - Pri 1
Type: Bug
State: Fixed
Assignee:
Difficulty: Normal
Category:
Backwards Compatible: True
Fix Submitted:
Affected versions: 7.2.2, 7.4.3
Due in version: 7.5.0
Sprint: Sprint 36
Story Points:
Cycle: