ARTIFACTORY: How to store NuGet icon file in Artifactory repo and support preview as iconURL in "NuPkg Info" page

ARTIFACTORY: How to store NuGet icon file in Artifactory repo and support preview as iconURL in "NuPkg Info" page

AuthorFullName__c
Sun Jinlong
articleNumber
000006315
ft:sourceType
Salesforce
FirstPublishedDate
2025-01-06T09:51:09Z
lastModifiedDate
2025-01-06
VersionNumber
2

Introduction 

The NuGet packages typically include an icon file that serves as a visual identifier, enabling developers to quickly recognize specific packages during browsing or search operations. This icon is either embedded within the NuGet package itself or referenced as an iconURL, pointing to a location where it can be previewed.
The Artifactory NuGet repository supports the NuPkg Info page to display the NuGet package info, including display the icon.

User-added image

When the iconURL within a NuGet package directs to an icon file stored in an Artifactory generic repository, the icon may fail to display correctly in Artifactory's NuPkg Info view. This issue arises because Artifactory repositories do not inherently support the online browsing of icon files, resulting in improper display of the icons.


Resolution

We can follow the steps below to modify the Artifactory mimetypes.xml file to support iconUrl display:

  • Edit the $JFROG_HOME/artifactory/var/etc/artifactory/mimetypes.xml configuration file and add the 
    following config:
    <mimetypes>
    ......
      <mimetype type="image/png" extensions="png" viewable="true" css="png" />                                            
    </mimetypes>
     
    • Restart the Artifactory cluster.
  • Create a Generic type local repo and open the Allow Artifact Content Browsing setting in the local repo configuration.
  • Upload the icon file to the local repo.
  • Build the NuGet package and add the iconUrl like the following:
    # .nuspec file ......     <iconUrl>https://<art_url>/ui/api/v1/download/contentBrowsing/<repo_key>/icon.png?isNativeBrowsing=true</iconUrl> ......
  • Upload the NuGet package to a NuGet repo.

User-added image

User-added image

User-added image