Add check for relative path in Local.relative
this is to prevent an infinite loop in explode_path
This commit is contained in:
parent
f4a5413c46
commit
a57013c3f3
|
@ -92,6 +92,12 @@ module Local = struct
|
|||
| i -> String.sub t ~pos:(i + 1) ~len:(len - i - 1)
|
||||
|
||||
let relative ?error_loc t path =
|
||||
if not (Filename.is_relative path) then (
|
||||
Exn.code_error "Local.relative: received absolute path"
|
||||
[ "t", Usexp.atom_or_quoted_string t
|
||||
; "path", Usexp.atom_or_quoted_string path
|
||||
]
|
||||
);
|
||||
let rec loop t components =
|
||||
match components with
|
||||
| [] -> Result.Ok t
|
||||
|
|
Loading…
Reference in New Issue