Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Quicksilver GetAssets<IContentImage> returns documents and images [12.16]



We have used the Quicksilver extension for getting images for a product. All of a sudden it also returns pdf files.

images = currentContent.GetAssets<IContentImage>(

Externsion method:

public static IList<string> GetAssets<TContentMedia>(this IAssetContainer assetContainer, IContentLoader contentLoader, UrlResolver urlResolver, string defaultAssets)
    where TContentMedia : IContentMedia
    var assets = new List<string>();
    if (assetContainer.CommerceMediaCollection != null)
        assets.AddRange(assetContainer.CommerceMediaCollection.Where(x => ValidateCorrectType<TContentMedia>(x.AssetLink, contentLoader)).Select(media => urlResolver.GetUrl(media.AssetLink)));

    if (!assets.Any())

    return assets;

Up until now the above code gave me only images. Has this function been updated?
The PDF is GenericData

[ContentType(GUID = "6ab524b7-0c98-4b67-bb5f-66d8090accd0")]
[MediaDescriptor(ExtensionString = "txt,pdf,docx,doc,xlsx,xls")]
public class GenericMedia : MediaData
    public virtual string Description { get; set; }

And images are ImageMediaData:

[ContentType(GUID = "20644be7-3ca1-4f84-b893-ee021b73ce6c")]
[MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png")]
public class ImageMediaData : CommerceImage


Jun 17, 2019 10:08

MediaData implements IContentMedia. If you only want to get images, you can call with CommerceImage instead.

I have no idea why it "suddenly" happen to you

Jun 18, 2019 10:57

My bad. We had some problems and modified the ValidateCorrectType() and there for a PDF was considered a valid image.

Thanks again!

Jun 18, 2019 11:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.