U4-9137 - Media Cache returning trashed items

Created by Lee Kelleher 02 Nov 2016, 12:51:12 Updated by Sebastiaan Janssen 20 Feb 2017, 13:52:50

Tags: Unscheduled

Relates to #U4-8856

[I added a comment...|http://issues.umbraco.org/issue/U4-8856#comment=67-32370]

I have a question about the GetUmbracoMediaCacheValues logic.


So the logic goes...

  1. Query Examine for media item - making sure that it hasn't been trashed (checking path for "-1,-21")
  2. If the media item isn't in Examine, then get from the MediaService and return

My question is, if when querying Examine we're checking if the item is trashed, but we're not doing the same when querying the MediaService. Wouldn't this mean that it will always return a trashed media item?

@zpqrtbnk [replied in agreement|http://issues.umbraco.org/issue/U4-8856#comment=67-32373]...

methink you're right and it should read

var media = ApplicationContext.Current.Services.MediaService.GetById(id); if (media == null || media.Trashed) return null; // not found, ok

Correct? Will fix.

''Raising this ticket for completion.''


Stephan 02 Nov 2016, 13:00:53

PR https://github.com/umbraco/Umbraco-CMS/pull/1563

test: media cache should not find a trashed media anymore

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 7.5.5

Sprint: Sprint 45

Story Points: