Skip to content

Commit 14bb03c

Browse files
committed
Merge pull request #5 from cortex-cms/chomp-request-url
Removing trailing slash if it appears and is not the root.
2 parents 6ee14f9 + 841a4c7 commit 14bb03c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/cortex/snippets/client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def current_webpage(request)
2929
def request_url(request)
3030
# TODO: Should be grabbing request URL in a framework-agnostic manner, but this is fine for now
3131
uri = Addressable::URI.parse(request.original_url)
32-
33-
"#{uri.scheme}://#{uri.authority}#{uri.path}"
32+
path = uri.path == "/" ? uri.path : uri.path.chomp("/")
33+
"#{uri.scheme}://#{uri.authority}#{path}"
3434
end
3535
end
3636
end

0 commit comments

Comments
 (0)