Code preview not working for some files?

I’ve noticed a lot of text files are not preview-able in gitlab, for instance .html files:
“No preview for this file type”

I deal with a lot of php, cfml, html, & CSS and it seems only .php files can be previewed (and most importantly, compared across commits & branches!!). Is there some way I can gitlab that these other file types should be treated as text?

I’m suffering the same problem (with sql files dumped by mysqldump).

It seems to be some kind of file encoding problem. Some of the files on this project can be previewed just fine, while others cannot. It’s a very frustrating issue that I have no idea how to solve. I wish gitlab had a button or dropdown or something on these files along the lines of “I think this is a binary file, would you like me to try and treat it as text anyway?”.

I have the same problem, and I’m starting to think it has to do with the length of the file, not the file type. I’ve tried switching between .txt and .php extensions to no avail. My files which are > 100k or so have this problem. Does that correspond with what the rest of you are seeing?

Yeah, I also think it is size-related, since the files look just fine in git extensions for example. There’s probably a parameter making the diff skip large files, but unfortunately i have no idea where to configure this, if it’s possible at all.

Hey people, is there any issue open describing this behavior? If not, can someone open one? Thanks.

i had same issue, and I figured it out some encoding(UTF-16LE, in my case) causes this problem. If you convert encoding you can see diffs.
I wrote a script(https://github.com/petermnhk/convall) for converting all files in some project at once.
So you can get the script and also do a test with some example files.

I have some Large File Storage (LFS) files in my Gitlab repo. The .gitattributes file in the root of the repo is configured to enable git diff to work properly for LFS files that are just large text files (as opposed to large binary files). So I can successfully git diff local changes I make to these text LFS files.

But I can’t see changes to those same files in Gitlab. When reviewing the changes to these files in a MR in Gitlab, Gitlab has tagged these files with the LFS marker (fair enough) and claims “No preview for this file type”, even though git diff works just fine locally.

Is there a way to enable the Gitlab web UI to show changes to LFS files whenever git diff can do it locally?