OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
handle null body in issue and pull_request events correctly
Markus Kahl72b1777f2cc6
diff --git a/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb b/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rbindex 2fb416c9918..82801ed3af6 100644--- a/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb+++ b/modules/github_integration/lib/open_project/github_integration/notification_handler/helper.rb@@ -44,7 +44,8 @@ module OpenProject::GithubIntegrationhost_name = Regexp.escape(Setting.host_name)wp_regex = /OP#(\d+)|http(?:s?):\/\/#{host_name}\/(?:\S+?\/)*(?:work_packages|wp)\/([0-9]+)/- text.scan(wp_regex)+ String(text)+ .scan(wp_regex).map { |first, second| (first || second).to_i }.select(&:positive?).uniqdiff --git a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/helper_spec.rb b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/helper_spec.rbindex d6f55900181..3233e55c3ca 100644--- a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/helper_spec.rb+++ b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/helper_spec.rb@@ -40,6 +40,10 @@ describe OpenProject::GithubIntegration::NotificationHandler::Helper doexpect(handler.extract_work_package_ids('')).to eq([])end+ it 'returns an empty array for a null source' do+ expect(handler.extract_work_package_ids(nil)).to eq([])+ end+it 'finds a work package by code' dosource = "Blabla\nOP#1234\n"expect(handler.extract_work_package_ids(source)).to eq([1234])