]> gitweb.factorcode.org Git - factor.git/commitdiff
urls: handle a series of /././././ in paths.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 15 Mar 2021 18:49:20 +0000 (11:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 15 Mar 2021 18:49:20 +0000 (11:49 -0700)
basis/urls/urls.factor

index 0347cd729295d9ef8dfc395df44a852453e3cac7..84a42f2d907e499f3de19d4a54d0319b0f3d1e4d 100644 (file)
@@ -147,7 +147,7 @@ M: url present
     ] "" make ;
 
 : remove-dot-segments ( path -- path' )
-    "/./" "/" replace
+    [ "/./" over subseq? ] [ "/./" "/" replace ] while
     [ "/../" split1 ] [ [ "/" split1-last drop ] dip "/" glue ] while*
     "/.." ?tail [ "/" split1-last drop "/" append ] when
     "../" ?head [ "/" prepend ] when