Skip to content

Commit

Permalink
fix: chomp slash from api url
Browse files Browse the repository at this point in the history
Avoid problems with double slashes on `get_url`
  • Loading branch information
wpramio committed Mar 31, 2023
1 parent 8f5ff61 commit 54001c7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/bigbluebutton_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class BigBlueButtonApi
# sha256:: Flag to use sha256 when hashing url contents for checksum
def initialize(url, secret, version=nil, logger=nil, sha256=false)
@supported_versions = ['0.8', '0.81', '0.9', '1.0']
@url = url
@url = url.chomp('/')
@secret = secret
@timeout = 10 # default timeout for api requests
@request_headers = {} # http headers sent in all requests
Expand Down Expand Up @@ -691,10 +691,8 @@ def get_url(method, params={})
params_string = "checksum=#{checksum}&#{params_string}"
return "#{@url}/#{method}", params_string
else
url = @url
url += "/" unless url.end_with?("/")
url += method.to_s
url += "?#{params_string}&" unless params_string.empty?
url = "#{@url}/#{method}?"
url += "#{params_string}&" unless params_string.empty?
url += "checksum=#{checksum}"
return url, nil
end
Expand Down

0 comments on commit 54001c7

Please sign in to comment.