diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-16 19:01:25 +0300 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-02-16 19:01:25 +0300 |
commit | 15126fc70ffaca07b6e6e487a7d3a4f0318ee882 (patch) | |
tree | ef2db830900a6ef462b1a9874766318ca04a5b76 /app/views/projects/blob | |
parent | bbbfdba0b9c0e2d5c463110398f7469821fd4c44 (diff) |
Fix SVG blob rendering
Diffstat (limited to 'app/views/projects/blob')
-rw-r--r-- | app/views/projects/blob/_image.html.haml | 8 |
1 files changed, 7 insertions, 1 deletions
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)} |