From b866f5326c88e5881b5b7ce5354ff35abbd79549 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Wed, 26 May 2004 17:48:27 +0000 Subject: [PATCH] Bug fixed: ls?baseuri=(cic|theory):/a/ also returned theory:/a.theory. --- helm/ocaml/getter/http_getter.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/helm/ocaml/getter/http_getter.ml b/helm/ocaml/getter/http_getter.ml index cf2ee593c..6192cacdc 100644 --- a/helm/ocaml/getter/http_getter.ml +++ b/helm/ocaml/getter/http_getter.ml @@ -407,10 +407,8 @@ let ls = if remote () then ls_remote regexp else begin - let pat = - Pcre.replace ~rex:trailing_slash_RE ("^" ^ regexp) -(* (match lsuri with Cic p -> ("cic:" ^ p) | Theory p -> ("theory:" ^ p)) *) - in + let looking_for_dir = Pcre.pmatch ~rex:trailing_slash_RE regexp in + let pat = Pcre.replace ~rex:trailing_slash_RE ("^" ^ regexp) in let (dir_RE, obj_RE) = (Pcre.regexp (pat ^ "/"), Pcre.regexp (pat ^ "(\\.|$)")) in @@ -444,13 +442,15 @@ let ls = (* BLEARGH Dbm module lacks support for fold-like functions *) (fun key _ -> match key with - | uri when Pcre.pmatch ~rex:dir_RE uri -> (* directory hit *) + | uri when looking_for_dir && Pcre.pmatch ~rex:dir_RE uri -> + (* directory hit *) let localpart = Pcre.replace ~rex:dir_RE uri in if Pcre.pmatch ~rex:no_slashes_RE localpart then store_obj localpart else store_dir localpart - | uri when Pcre.pmatch ~rex:obj_RE uri -> (* file hit *) + | uri when (not looking_for_dir) && Pcre.pmatch ~rex:obj_RE uri -> + (* file hit *) store_obj (Pcre.replace ~rex:til_slash_RE uri) | uri -> () (* miss *)); let ls_items = ref [] in -- 2.39.2