Files prefixed with readme are rendered rather than displayed as source

Summary

When a file is prefixed with readme, regardless of casing, it is rendered in GitLab, rather than displayed as source.

Steps to reproduce

  1. Create a new project in GitLab
  2. Add a file named ReadMetadata.php and populate it with a simple script.
  3. Commit
  4. Browse to the file in GitLab

Example Project

https://gitlab.com/bheiskell/read-what/blob/master/ReadMetadata.php

What is the current bug behavior?

The file is displayed as though it is a readme file. "Display rendered file" is selected at the top right of the file menu bar.

What is the expected correct behavior?

The file should be displayed as source. If "Display source" is clicked, that would be the expected behavior.

Relevant logs and/or screenshots

Bad behavior: image

Expected behavior: image

Output of checks

This bug happens on GitLab.com

Possible fixes

This is tricky. I think the easiest way to fix this is to change the insensitive check for a prefix of readme.. However, that could still result in rendering someone's readme.php. Ideally, there would be a list of known prefix and suffixes that where whitelisted for this functionality. Something like readme*.md.

/label ~bug

Edited Oct 05, 2018 by Benjamin Heiskell
Assignee Loading
Time tracking Loading