Skip to content

MediaFilePathResolver.cs

Finds the file behind a media item.

Extraction reads from disk, so every source import starts by turning a media key into an absolute path.

string? Resolve(Guid mediaKey);

Returns null when the item does not exist, holds no file, or the file is missing from disk.

The umbracoFile property holds either a bare path or a JSON object, depending on the media type’s property editor:

/media/abc123/brochure.pdf
{ "src": "/media/abc123/brochure.pdf" }

Both are handled. The logic had been duplicated privately in more than one controller before it was extracted here.