Skip to content

Commit

Permalink
ensure trailing slash in federation portals ui and api links
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Nov 26, 2024
1 parent 2c1d38b commit 07f3c15
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/helpers/federation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module FederationHelper

def federated_portals
$FEDERATED_PORTALS ||= LinkedData::Client.settings.federated_portals
normalize_portals($FEDERATED_PORTALS)
$FEDERATED_PORTALS
end

def internal_portal_config(id)
Expand Down Expand Up @@ -257,4 +259,11 @@ def most_referred_portal(ontology_submissions)
portal_counts.max_by { |_, count| count }&.first
end

def normalize_portals(portals)
portals.each do |_, portal|
portal[:ui] += "/" unless portal[:ui].end_with?("/")
portal[:api] += "/" unless portal[:api].end_with?("/")
end
end

end

0 comments on commit 07f3c15

Please sign in to comment.