Skip to content

Commit

Permalink
fix any extra slash in start of the path
Browse files Browse the repository at this point in the history
when building URL
  • Loading branch information
balen committed Dec 27, 2023
1 parent d68e3cc commit 3a63fd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/services/url_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ def self.url_for(path:)
host = ENV["HOSTNAME"]
port = ENV["HOSTPORT"]

# Remove any slash from the start of the path if there happens to be one
# as we add one when building the URL with the protocol and host
if path.start_with?("/")
path = path[1..-1]
end

if port
"#{protocol}://#{host}:#{port}/#{path}"
else
Expand Down

0 comments on commit 3a63fd5

Please sign in to comment.