Friday, 4 January 2013

svn issue cannot display: file marked as binary type

It is possible that you may face following issue while comparing different versions of a file - specially with .css and .js file as following:

CAUSE: It happens when SVN is not able to identify the mime-type for a file and sets it as application/octetstream




FIX: To verify, select SVN properties of a any file under SVN repository. The popup shows the MIME-TYPE (if any). You can select MIME type and hit Remove button as shown below:



However, if you have a lot of files, you can execute following batch command. It checks for all .css and .js files and set there mime-type to nothing. This worked great for me in a live project. It recursively iterates through all files from where the batch is executed, and deletes mime-type property for .js and .css file (if set). Later you would need to commit all the files for changes to take place so you've an option to view changes before updating server repository.

echo off
setlocal EnableDelayedExpansion
FOR /R %%G in ("*.js") DO (
svn propdel svn:mime-type %%G
)
FOR /R %%G in ("*.css") DO (
svn propdel svn:mime-type %%G
)

No comments:

Post a Comment