diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-04 14:19:05 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-04 14:19:05 +0200 |
commit | 06399b3261a4118bf5ab2d2c6fcee7aad869bc66 (patch) | |
tree | e87572c671ba0566b32129840a0b7a6dbc3820e0 /lib/gitlab/google_code_import | |
parent | e8fb197da285e7af1d39ba626f2f0f5c20c17eed (diff) | |
download | gitlab-ce-06399b3261a4118bf5ab2d2c6fcee7aad869bc66.tar.gz |
Show Google Code image attachments inline.
Diffstat (limited to 'lib/gitlab/google_code_import')
-rw-r--r-- | lib/gitlab/google_code_import/importer.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/google_code_import/importer.rb b/lib/gitlab/google_code_import/importer.rb index 84ad1516571..8bdb46237fc 100644 --- a/lib/gitlab/google_code_import/importer.rb +++ b/lib/gitlab/google_code_import/importer.rb @@ -314,8 +314,12 @@ module Gitlab raw_attachments.map do |attachment| next if attachment["isDeleted"] - link = "https://storage.googleapis.com/google-code-attachments/#{@repo.name}/issue-#{issue_id}/comment-#{comment_id}/#{attachment["fileName"]}" - "[#{attachment["fileName"]}](#{link})" + filename = attachment["fileName"] + link = "https://storage.googleapis.com/google-code-attachments/#{@repo.name}/issue-#{issue_id}/comment-#{comment_id}/#{filename}" + + text = "[#{filename}](#{link})" + text = "!#{text}" if filename =~ /\.(png|jpg|jpeg|gif|bmp|tiff)\z/ + text end.compact end end |