Skip to content

Commit 841a4c7

Browse files
committed
Removing trailing slash if it appears and is not the root.
1 parent 6ee14f9 commit 841a4c7

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)