Skip to content

Use correct symbol for comment creation error handling

Chris Stone requested to merge cms-master-patch-90873 into master

What does this MR do and why?

Importing comments from Gitea can result in errors (for whatever reason). The current rescue for such errors references an incorrect symbol (raw[:url]) and results in:

"meta.root_caller_id":"Import::GiteaController#create",
"exception.class":"NoMethodError","exception.message":"undefined method `gsub' for nil:NilClass\n\n      content.gsub(URI_REGEXP) do |url|\n             ^^^^^",
"exception.backtrace":["lib/gitlab/url_sanitizer.rb:37:in `sanitize'",
"lib/gitlab/legacy_github_import/importer.rb:250:in `rescue in block (2 levels) in create_comments'",
"lib/gitlab/legacy_github_import/importer.rb:233:in `block (2 levels) in create_comments'",
"lib/gitlab/legacy_github_import/importer.rb:232:in `each'",
"lib/gitlab/legacy_github_import/importer.rb:232:in `block in create_comments'",
"lib/gitlab/legacy_github_import/importer.rb:231:in `create_comments'",
"lib/gitlab/legacy_github_import/importer.rb:224:in `block in import_comments'"

This MR corrects the symbol so that the error is handled/reported correctly.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

image

How to set up and validate locally

This is difficult to reproduce as all current known problems with Gitea comment imports have been addressed. The problem is only seen when an exception occurs importing/creating comments from Gitea.

Merge request reports