Skip to content

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

Render links to meeting locations only if they are valid URLs

Aaron Contreras8ac6616f1afd
diff --git a/modules/meeting/app/components/meetings/row_component.rb b/modules/meeting/app/components/meetings/row_component.rb
index 3e297500825..02e60226b6f 100644
--- a/modules/meeting/app/components/meetings/row_component.rb
+++ b/modules/meeting/app/components/meetings/row_component.rb
@@ -47,12 +47,24 @@ module Meetings
end
def location
- if model.location.present?
+ if valid_meeting_location_link?
link_to h(model.location),
model.location,
target: '_blank',
rel: 'noopener'
+ else
+ h(model.location)
end
end
+
+ private
+
+ def valid_meeting_location_link?
+ URI.parse(model.location)
+ .host
+ .present?
+ rescue URI::InvalidURIError
+ false
+ end
end
end