From 15126fc70ffaca07b6e6e487a7d3a4f0318ee882 Mon Sep 17 00:00:00 2001
From: Jacob Vosmaer <contact@jacobvosmaer.nl>
Date: Tue, 16 Feb 2016 17:01:25 +0100
Subject: [PATCH] Fix SVG blob rendering

---
 app/views/projects/blob/_image.html.haml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/views/projects/blob/_image.html.haml b/app/views/projects/blob/_image.html.haml
index 51fa91b08e4..6955b7086b9 100644
--- a/app/views/projects/blob/_image.html.haml
+++ b/app/views/projects/blob/_image.html.haml
@@ -1,2 +1,8 @@
 .file-content.image_file
-  %img{ src: namespace_project_raw_path(@project.namespace, @project, @id)}
+  - if blob_svg?(blob)
+    - # We need to scrub SVG but we cannot do so in the RawController
+    - blob.load_all_data!(@repository)
+    - blob = sanitize_svg(blob)
+    %img{ src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"}
+  - else
+    %img{ src: namespace_project_raw_path(@project.namespace, @project, @id)}
-- 
GitLab