I have a URL property type on an Optimizely block that could be an external URL or media item.
When rendered, the the URL is of the format: /link/some_kind_of_id.aspx
That relative URL will work, as the Epi HTTP handler will determine if it's a media item or not, and return whatever the resource is.
What I need to do is programmatically use this ID to determine if the URL is that of an uploaded media item so I can get the filename of the uploaded media item and do some additional processing.
However, I can't find any information in any old or new Epi/Opti documentation/guides.
I was hoping I could use something like the ContentLoader to get the content or the BlobFactory. The former requires a content link and the latter requires a GUID - I have neither.
Is there any way I can programmatically get more info from a URL property value via it's "UriInternal" link?
TIA
IUrlResolver.Route(...)
has an overload that takes an UrlBuilder
where you can pass in this value. If it return an IContent
object, then you know it's a content item. You can then check if it's an IContentMedia
.