diff options
author | Bart Libert <bart.libert@gmail.com> | 2018-04-05 13:44:18 +0200 |
---|---|---|
committer | Bart Libert <bart.libert@gmail.com> | 2018-05-24 13:28:58 +0200 |
commit | 4bfd54f3d2e303d751d49834879867f3c62156e9 (patch) | |
tree | 14bec3c9ce3fefc68a6a0664da91470880b3cbed /lib | |
parent | 942fe5fe79f512b4c801fc887a1240a963b827d0 (diff) | |
download | gitlab-ce-4bfd54f3d2e303d751d49834879867f3c62156e9.tar.gz |
Import bitbucket issues that are reported by an anonymous user
For these kind of issues, the "reporter" field is present but zero.
In such a case, "fetch" will not return the default value, but it will
return nil.
Hence, importing fails, because the "username" field of nil is referenced
Fixes issue #44381
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitbucket/representation/issue.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_formatter.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/bitbucket/representation/issue.rb b/lib/bitbucket/representation/issue.rb index 054064395c3..44bcbc250b3 100644 --- a/lib/bitbucket/representation/issue.rb +++ b/lib/bitbucket/representation/issue.rb @@ -12,7 +12,7 @@ module Bitbucket end def author - raw.fetch('reporter', {}).fetch('username', nil) + raw.dig('reporter', 'username') end def description diff --git a/lib/gitlab/import_formatter.rb b/lib/gitlab/import_formatter.rb index 3e54456e936..4e611e7f16c 100644 --- a/lib/gitlab/import_formatter.rb +++ b/lib/gitlab/import_formatter.rb @@ -9,6 +9,7 @@ module Gitlab end def author_line(author) + author ||= "Anonymous" "*Created by: #{author}*\n\n" end end |