appx and nupkg artifact files download automatically renamed to zip

When build artifacts with the extensions appx and nupkg are uploaded, build-agent recognizes them as zip files due to them technically being the same, and will automatically attach a content type of application/zip. build-agent uses the following go package to determine the MIME type:

https://golang.org/pkg/mime/#TypeByExtension

There is a workaround by specifying the content type in /etc/mime.types file or for the Windows executor, a modification in the registry is necessary. This configuration allows appx and nupkg files to retain the content type of application/octet-stream

 

Windows

      - run:
          name: Adding MIME types for MSIX
          shell: powershell.exe
          command: |
            reg add HKCR\.appx /v "Content Type" /t REG_SZ /d "application/vns.ms-appx"
            reg add HKCR\.nupkg /v "Content Type" /t REG_SZ /d "application/vns.ms-appx"

Linux

      - run:
name: Adding MIME types command: | sudo bash -c "echo 'application/octet-stream nupkg' >> /etc/mime.types" sudo bash -c "echo 'application/octet-stream appx' >> /etc/mime.types"

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.