remove use of String.ends_with for compat with 4.08

This commit is contained in:
Simon Cruanes 2023-08-31 23:28:15 -04:00
parent 883d4bb806
commit 063c046933
2 changed files with 3 additions and 4 deletions

View file

@ -95,7 +95,7 @@ end = struct
('a, error) result Lwt.t =
let url =
let url = config.url in
if String.ends_with url ~suffix:"/" then
if url <> "" && String.get url (String.length url - 1) = '/' then
String.sub url 0 (String.length url - 1)
else
url
@ -115,8 +115,7 @@ end = struct
try%lwt
let+ r = Httpc.post ~headers ~body uri in
Ok r
with e ->
Lwt.return @@ Error e
with e -> Lwt.return @@ Error e
in
match r with
| Error e ->

View file

@ -125,7 +125,7 @@ end = struct
let data = Pbrt.Encoder.to_string encoder in
let url =
let url = config.Config.url in
if String.ends_with url ~suffix:"/" then
if url <> "" && String.get url (String.length url - 1) = '/' then
String.sub url 0 (String.length url - 1)
else
url