File comparison displays the message "This file cannot be rendered in your browser" but source view works fine

I'm experiencing this problem with .sql files: I can view the source but when I look at commit details I get the message "This file cannot be rendered in your browser" and if I click on "Diff to previous" I get an endless spinning loading gif.

One strange thing is that while viewing the source, the first character of the first row is a little red dot.
If I move the mouse on the red dot there's a tooltip saying "\uteff"

Is someone experiencing the same problem?

We are using Stash 3.5 64bit on Centos 7

5 answers

1 accepted

One of the reasons you're seeing issues with the diff is that your SQL files contain a Byte Order Mark (BOM), this is the 0xFEFF sequence you're seeing at the start of the file.  Unfortunately these bytes means git treats the file as binary, not text, and so any operations that depend on git, such as generating a diff, aren't going to return what you expect.

You would also see this behaviour if you did a git diff on some commits in your repo from the command line, as Stash calls out to git for all it's operations:

Binary files a/file.sql and b/file.sql differ

In order for git to properly diff your SQL files you would need to ensure they're saved without the BOM byte, or you could use a git filter to ensure the BOM gets stripped when you commit the file.

As for the issue with "Diff to previous" - that's a real bug in Stash 3.5 with binary files in the source view, I have raised STASH-6866 to track this.

I you are right! After removing the BOM from one of the SQL and commiting several modifications I can use the source comparison. Thank you very much for your help. :-) Now I must find a way to apply a git filter as you suggested. let's got o study. :-) Thank you again. Alessandro

What if the BOM is required for build purposes? I tried using .gitattributes to make git treat UTF-16 xml files as text, but they still won't show a diff in the Bitbucket diff despite being able to be displayed in a git diff.

Any kind of SQL files in particular, or all SQL files? That is, are they large, small, what SQL dialect are they? Stash 3.5 introduced changes to syntax highlighting in the file view, so trying to work out what in particular is causing this.

It happens with every SQL file. they are SqlServer 2005 stored procedures

Would it be possible for you to open a support ticket at and attach an example of a file that exhibits this behaviour so that we can try and reproduce the issue?

Done, thank you. I opened the ticket number SSP-6608

Reviewing SSP-6608, I see that the problem was resolved after removing the BOM at the beginning of the file.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,750 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you