Skip to content

Commit 54001c7

Browse files
committed
fix: chomp slash from api url
Avoid problems with double slashes on `get_url`
1 parent 8f5ff61 commit 54001c7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/bigbluebutton_api.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class BigBlueButtonApi
7373
# sha256:: Flag to use sha256 when hashing url contents for checksum
7474
def initialize(url, secret, version=nil, logger=nil, sha256=false)
7575
@supported_versions = ['0.8', '0.81', '0.9', '1.0']
76-
@url = url
76+
@url = url.chomp('/')
7777
@secret = secret
7878
@timeout = 10 # default timeout for api requests
7979
@request_headers = {} # http headers sent in all requests
@@ -691,10 +691,8 @@ def get_url(method, params={})
691691
params_string = "checksum=#{checksum}&#{params_string}"
692692
return "#{@url}/#{method}", params_string
693693
else
694-
url = @url
695-
url += "/" unless url.end_with?("/")
696-
url += method.to_s
697-
url += "?#{params_string}&" unless params_string.empty?
694+
url = "#{@url}/#{method}?"
695+
url += "#{params_string}&" unless params_string.empty?
698696
url += "checksum=#{checksum}"
699697
return url, nil
700698
end

0 commit comments

Comments
 (0)