Question: I have a node script that fetches all the peers. Can I filter that output using php?

I mean I dont need all the peers fetched by that script, so can i just get some specific peers using functions like `strcmp`? Currently my node script outputs the result in an html page. But I want it to be printed on php page with filter applied to it.

Answer: 
Found it. seems the content type is set in ruby code in the raw\_controller.rb file. so i edit

```
/opt/gitlab/embedded/service/gitlab-rails/app/controllers/projects/raw_controller.rb

```

change this:

```
  def get_blob_type
    if @blob.text?
      'text/plain; charset=utf-8'
    else
      'application/octet-stream'
    end
  end

```

to something like this:

```
  def get_blob_type
    extn = File.extname(@blob.name).downcase
    if @blob.text?
      if extn == ".svg"
        'image/svg+xml'
      else 
        'text/plain; charset=utf-8'
      end
    else
      case extn
        when ".jpg", ".jpeg"
          'image/jpeg'
        when ".gif"
          'image/gif'
        when ".png"
          'image/png'
        when ".bmp"
          'image/bmp'
        when ".tiff"
           'image/tiff'
        else
          'application/octet-stream'
      end
    end
  end

```

then `sudo gitlab-ctrl restart`

now in my markdown, if i do this:

```
![my-diagram](http://server/my-group/my-project/raw/master/docsfolder/my-drawing.svg)

```

it works!

I've never used ruby before, so maybe there's a better way, but so far works for me.
101chris's proposal works fine on 7.x, but needs some rework on gitlab 8.x.
Here's my update tested on 8.14.4:

/opt/gitlab/embedded/service/gitlab-rails/app/helpers/blob\_helper.rb :

```
  def safe_content_type(blob)
    if blob.text?
      case File.extname(blob.name).downcase
      when '.html'
        'text/html'
      when '.css'
        'text/css'
      when '.xml'
        'text/xml'
      when '.js'
        'application/javascript'
      else
        'text/plain; charset=utf-8'
      end
    elsif blob.image?
      blob.content_type
    else
      'application/octet-stream'
    end
  end

```