Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-04 15:19:05 +0300
committerDouwe Maan <douwe@gitlab.com>2015-04-04 15:19:05 +0300
commit06399b3261a4118bf5ab2d2c6fcee7aad869bc66 (patch)
treee87572c671ba0566b32129840a0b7a6dbc3820e0 /lib/gitlab/google_code_import
parente8fb197da285e7af1d39ba626f2f0f5c20c17eed (diff)
Show Google Code image attachments inline.
Diffstat (limited to 'lib/gitlab/google_code_import')
-rw-r--r--lib/gitlab/google_code_import/importer.rb8
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