From 54001c7b2feea9ca7e4198a6e3d7fa90fd26d3c7 Mon Sep 17 00:00:00 2001 From: wpramio Date: Fri, 31 Mar 2023 16:28:44 -0300 Subject: [PATCH] fix: chomp slash from api url Avoid problems with double slashes on `get_url` --- lib/bigbluebutton_api.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/bigbluebutton_api.rb b/lib/bigbluebutton_api.rb index d00a372..bec6fc5 100644 --- a/lib/bigbluebutton_api.rb +++ b/lib/bigbluebutton_api.rb @@ -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 @@ -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