Skip to content
Snippets Groups Projects
Commit 06399b32 authored by Douwe Maan's avatar Douwe Maan
Browse files

Show Google Code image attachments inline.

parent e8fb197d
No related branches found
No related tags found
1 merge request!471Import projects from Google Code.
Pipeline #
Loading
@@ -314,8 +314,12 @@ module Gitlab
Loading
@@ -314,8 +314,12 @@ module Gitlab
raw_attachments.map do |attachment| raw_attachments.map do |attachment|
next if attachment["isDeleted"] next if attachment["isDeleted"]
   
link = "https://storage.googleapis.com/google-code-attachments/#{@repo.name}/issue-#{issue_id}/comment-#{comment_id}/#{attachment["fileName"]}" filename = attachment["fileName"]
"[#{attachment["fileName"]}](#{link})" 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/
  • Why bmp and tiff? IIRC lots of browsers have issues with such encoding, right?

  • Author Maintainer

    It's the same list that's used for regular GitLab uploads. I have no idea why those were chosen but I'm not gonna argue it :)

  • Please register or sign in to reply
text
end.compact end.compact
end end
end end
Loading
Loading
Loading
@@ -372,6 +372,11 @@
Loading
@@ -372,6 +372,11 @@
"fileName" : "tint2_task_scrolling.diff", "fileName" : "tint2_task_scrolling.diff",
"fileSize" : 3059, "fileSize" : 3059,
"mimetype" : "text/x-c++; charset=us-ascii" "mimetype" : "text/x-c++; charset=us-ascii"
}, {
"attachmentId" : "000",
"fileName" : "screenshot.png",
"fileSize" : 0,
"mimetype" : "image/png"
} ] } ]
}, { }, {
"id" : 1, "id" : 1,
Loading
Loading
Loading
@@ -49,7 +49,8 @@ describe Gitlab::GoogleCodeImport::Importer do
Loading
@@ -49,7 +49,8 @@ describe Gitlab::GoogleCodeImport::Importer do
expect(issue.description).to include('Patch is attached that adds two new mouse\-actions \(next\_taskprev\_task\)') expect(issue.description).to include('Patch is attached that adds two new mouse\-actions \(next\_taskprev\_task\)')
expect(issue.description).to include('that can be used for exactly that purpose.') expect(issue.description).to include('that can be used for exactly that purpose.')
expect(issue.description).to include('all the best!') expect(issue.description).to include('all the best!')
expect(issue.description).to include('https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/tint2_task_scrolling.diff') expect(issue.description).to include('[tint2_task_scrolling.diff](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/tint2_task_scrolling.diff)')
expect(issue.description).to include('![screenshot.png](https://storage.googleapis.com/google-code-attachments/tint2/issue-169/comment-0/screenshot.png)')
end end
   
it "imports issue comments" do it "imports issue comments" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment