We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10fbf04 commit c99abf0Copy full SHA for c99abf0
src/html/link.ml
@@ -15,16 +15,15 @@ module Path = struct
15
16
let remap config f =
17
let l = String.concat "/" f in
18
- match
19
- List.find_opt
+ try
+ let (prefix, replacement) = List.find
20
(fun (prefix, _replacement) -> Astring.String.is_prefix ~affix:prefix l)
21
- (Config.remap config)
+ (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)
25
with
- | None -> None
- | Some (prefix, replacement) ->
- let len = String.length prefix in
26
- let l = String.sub l len (String.length l - len) in
27
- Some (replacement ^ l)
+ | Not_found -> None
28
29
let get_dir_and_file ~config url =
30
let l = Url.Path.to_list url in
0 commit comments