On my local standalone instance, I have a case where I am expecting an absolute URL for a media library item. However, in preview mode, the returned URL is never absolute:
MediaUrlBuilderOptions options = new MediaUrlBuilderOptions()
{
AlwaysIncludeServerUrl = true,
AbsolutePath = true
};
string url = HashingUtils.ProtectAssetUrl(MediaManager.GetMediaUrl(mediaItem, options));
// preview mode returns /-/media/images/my-image.jpg
// normal mode returns https://mysite.sc/-/media/images/my-image.jpg
My site config is:
<site name="website" set:targetHostName="mysite.sc" set:hostName="mysite.sc" />
This happens whether or not I have hostName
set.
Is this expected behavior?