Skip to content

Commit c99abf0

Browse files
committed
Compat
1 parent 10fbf04 commit c99abf0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/html/link.ml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ module Path = struct
1515

1616
let remap config f =
1717
let l = String.concat "/" f in
18-
match
19-
List.find_opt
18+
try
19+
let (prefix, replacement) = List.find
2020
(fun (prefix, _replacement) -> Astring.String.is_prefix ~affix:prefix l)
21-
(Config.remap config)
21+
(Config.remap config) in
22+
let len = String.length prefix in
23+
let l = String.sub l len (String.length l - len) in
24+
Some (replacement ^ l)
2225
with
23-
| None -> None
24-
| Some (prefix, replacement) ->
25-
let len = String.length prefix in
26-
let l = String.sub l len (String.length l - len) in
27-
Some (replacement ^ l)
26+
| Not_found -> None
2827

2928
let get_dir_and_file ~config url =
3029
let l = Url.Path.to_list url in

0 commit comments

Comments
 (0)