ensure vars are valid - fix crashlog error line 56 +121

This commit is contained in:
Charles Ewert 2023-03-03 20:21:09 -05:00
parent 57a4a5cf38
commit 45209b148e

View File

@ -53,7 +53,9 @@ end function
function APIRequest(url as string, params = {} as object)
req = createObject("roUrlTransfer")
req.setCertificatesFile("common:/certs/ca-bundle.crt")
if get_setting("server").left(8) = "https://"
req.setCertificatesFile("common:/certs/ca-bundle.crt")
end if
full_url = buildURL(url, params)
req.setUrl(full_url)
@ -118,15 +120,16 @@ end function
function get_url()
base = get_setting("server")
if base.right(1) = "/"
base = base.left(base.len() - 1)
end if
if base <> invalid
if base.right(1) = "/"
base = base.left(base.len() - 1)
end if
' append http:// to the start if not specified
if base.left(7) <> "http://" and base.left(8) <> "https://"
base = "http://" + base
' append http:// to the start if not specified
if base.left(7) <> "http://" and base.left(8) <> "https://"
base = "http://" + base
end if
end if
return base
end function