Skip to content

Text-based job artifacts are not being opened inside web browser

Summary

Text-based job artifacts with file extensions matching the supported extensions to be served by Pages are not being opened in the browser, and are instead being automatically downloaded. The only file extension that does render in the browser is .html.

The documentation for artifacts:expose_as even specifies that extensions such as .txt and .log should be rendered by Pages:

image

But when clicking on my .txt and .log artifacts, my browser automatically downloads the files after being briefly redirected to my <group>.pages.company.com/<subgroup>/<project>/... URL. For .html files, however, I am redirected to my Pages site, and the HTML file is properly rendered inside the browser.

Additionally, all files with extensions called out by the documentation (.txt, .log, .html, etc.), are indeed listed in the artifact browser with the "Opens in a new window" icon and tooltip:

image

Seeing this icon on both .txt and .html files, but having them behave differently is confusing in itself.

Steps to reproduce

  1. Run a pipeline with a job configured to store a .txt or .log file as an artifact.
  2. When the job finishes, navigate to its page and click "Browse artifacts" button.
  3. Observe the .txt and .log files are marked with the image icon.
  4. Click the file to open it.
  5. Observe the file is automatically downloaded by the browser instead of being rendered.

What is the current bug behavior?

Text-based job artifacts with supported file extensions are not opened inside the browser, with the exception of .html files.

What is the expected correct behavior?

All text-based job artifacts with supported file extensions (.html, .htm, .txt, .json, .xml, and .log) should be opened inside the browser and not automatically downloaded.

Relevant information

  • Using a self-hosted instance of gitlab 13.9.2-ee
  • Project is inside a subgroup and is set to "private"
  • Browser is Chrome Version 89.0.4389.72 (Official Build) (64-bit)